GVKun编程网logo

我的 nextjs 应用程序中没有 index.html 文件 Netlify 不喜欢那样(nexturl)

4

在这篇文章中,我们将为您详细介绍我的nextjs应用程序中没有index.html文件Netlify不喜欢那样的内容,并且讨论关于nexturl的相关问题。此外,我们还会涉及一些关于CI框架去除ind

在这篇文章中,我们将为您详细介绍我的 nextjs 应用程序中没有 index.html 文件 Netlify 不喜欢那样的内容,并且讨论关于nexturl的相关问题。此外,我们还会涉及一些关于CI框架去除indexphp excel index index finger z index、graphql 在本地工作但不在 Netlify (Gatsby + Netlify CMS)、index range scan,index fast full scan,index sk...、index.html 怎么导入一个top.html 和footer.html的知识,以帮助您更全面地了解这个主题。

本文目录一览:

我的 nextjs 应用程序中没有 index.html 文件 Netlify 不喜欢那样(nexturl)

我的 nextjs 应用程序中没有 index.html 文件 Netlify 不喜欢那样(nexturl)

如何解决我的 nextjs 应用程序中没有 index.html 文件 Netlify 不喜欢那样

除非有 index.html 文件,否则 Netlify 不允许您部署网站。当我创建下一个应用程序时,Nextjs 并没有为我设置一个。有人知道如何解决这个问题吗?

解决方法

背景

在 Netlify 上部署 Next.js 有两种主要方式:作为静态网站或使用 next-on-netlify

默认情况下,Netlify 部署静态网站,而 Next.js 是动态的。 Next.js 需要一个服务器。当您运行 npm run build 来构建 Next.js 时,您实际上并不是在创建 HTML 页面。相反,您正在创建 Next.js 服务器将为访问者提供的生产资产。这就是您没有看到 index.html 文件的原因。

静态网站

如果您的网站是完全静态的,这可能是一个不错的选择。您的网站将快速火爆。这会将您的整个网站导出为 HTML、CSS、JS 和所有静态资产(例如图片)。

要使用它,请将 package.json 中的构建命令更新为 next build && next export。然后在站点的 Netlify 设置中,确保构建命令为 npm run build'' and the publish directory is out`。

Next.js 文档中有更多关于此的详细信息。尤其要注意阅读此静态导出支持和不支持的内容。

https://nextjs.org/docs/advanced-features/static-html-export

Netlify 的下一步

几个月前,Netlify 发布了一个名为“Next on Netlify”的插件。这只是一个插件,使使用他们的 next-on-netlify npm 包更容易使用。

这将使您充分利用 Next.js。

要使用它,只需转到您的插件选项卡,搜索“Next on Netlify”,然后添加插件。

如果您想了解更多详情,请查看他们的博文:https://www.netlify.com/blog/2020/12/07/announcing-one-click-install-next.js-build-plugin-on-netlify/

这是 Github 存储库的链接:https://github.com/netlify/next-on-netlify

CI框架去除indexphp excel index index finger z index

CI框架去除indexphp excel index index finger z index

转自:http://zhidao.baidu.com/link?url=vmpvphh36efxqgr65dit9hvmolh_kha333fceqk_vqibyvxrxm0weewsllfsv-8oenpcbt31yosgfgqtxhvcwczivukbyfadb_jgndmskdu

正文:

<span>apache环境下:
通过 .htaccess 文件来设置一些简单的规则删除它。下面是一个例子,使用“negative”方法将非指定内容进行重定向:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

如果你的项目不在根目录请把上面这一句改为:RewriteRule ^(.*)$ index.php/$1 [L]
在上面的例子中,可以实现任何非 index.php、images 和 robots.txt 的 HTTP 请求都被指向 index.php。

Nginx环境下:
修改nginx配置文件,在SERVER段中添加如下代码:
location /{
   if (-f $request_filename) {
       expires max;
       break;
   }
   if (!-e $request_filename) {
       rewrite ^/(.*)$ /index.php/$1 last;
   }
}</span>
登录后复制

以上就介绍了CI框架去除indexphp,包括了index方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

graphql 在本地工作但不在 Netlify (Gatsby + Netlify CMS)

graphql 在本地工作但不在 Netlify (Gatsby + Netlify CMS)

如何解决graphql 在本地工作但不在 Netlify (Gatsby + Netlify CMS)

我正在尝试将 Markdown 文件注入到我的 Gatsby 页面中,该页面在本地运行(开发和服务器)。但是,同样的 graphql 查询在 Netlify 中无法返回数据。对我来说似乎很奇怪。

这是一个示例 graphql 查询。

  1. export const query = graphql`
  2. query {products_horizontal: file(
  3. sourceInstanceName: { eq: "products" }
  4. childMarkdownRemark: { frontmatter: { vertical: { eq: false } } }
  5. ) {
  6. sourceInstanceName
  7. childMarkdownRemark {
  8. frontmatter {
  9. title
  10. date
  11. store
  12. vertical
  13. price
  14. image
  15. templateKey
  16. description
  17. featuredpost
  18. featuredimage
  19. tag
  20. color
  21. }
  22. }
  23. }}`

我在构建时添加了一个 console.log 来查看我的数据对象的内容,下面是我的应用程序的本地构建

  1. products_horizontal: {
  2. sourceInstanceName: ''products'',childMarkdownRemark: { frontmatter: [Object] }
  3. },

如您所见,product_horizo​​ntal 有一个备注节点。现在,当涉及到 netlify 中完全相同的文件时。我得到以下信息:

  1. products_horizontal: null

注意:当我从过滤器中删除 frontmatter: { vertical: { eq: false } } 时,它也适用于 Netlify。

我已经被这个错误困扰了大约 6 个小时,非常感谢您的帮助。我现在将添加更多代码以供参考。 gatsby-config.js

  1. module.exports = {
  2. plugins: [
  3. `gatsby-plugin-sass`,`gatsby-plugin-sharp`,"gatsby-plugin-netlify-cms",`gatsby-transformer-sharp`,{
  4. resolve: `gatsby-transformer-remark`,options: {
  5. // commonmark mode (default: true)
  6. commonmark: true,// Footnotes mode (default: true)
  7. footnotes: true,// Pedantic mode (default: true)
  8. pedantic: true,// GitHub Flavored Markdown mode (default: true)
  9. gfm: true,// Plugins configs
  10. plugins: [],},{
  11. resolve: `gatsby-source-filesystem`,options: {
  12. name: "images",path: `${__dirname}/src/images`,options: {
  13. name: "products",path: `${__dirname}/product`,options: {
  14. name: "blogs",path: `${__dirname}/blog`,options: {
  15. name: "tags",path: `${__dirname}/tag`,{
  16. resolve: "gatsby-plugin-layout",options: {
  17. component: require.resolve(`./src/components/Layout/index.tsx`),{
  18. resolve: `gatsby-plugin-intl`,options: {
  19. path: `${__dirname}/src/intl`,languages: [`en`,`az`,`ru`],defaultLanguage: `en`,redirect: false,],}

index range scan,index fast full scan,index sk...

index range scan,index fast full scan,index sk...

index range scan (索引范围扫描):

1. 对于 unique index 来说,如果 where 条件后面出现了 <,> ,between ...and... 的时候,那么就可能执行 index range scan, 如果 where 条件后面是 =,那么就会执行 index unique scan。

2. 对于 none unique index 来说 如果 where 条件后面出现了 =,>,<,betweed...and... 的时候,就有可能执行 index range scan。

3. 对于组合索引来说,如果 where 条件后面出现了组合索引的引导列,那么可能执行 index range scan。

 

index fast full scan (索引快速全扫描):

如果 select 语句后面中的列都被包含在组合索引中,而且 where 后面没有出现组合索引的引导列,并且需要检索出大部分数据,那么这个时候可能执行 index fast full scan。index fast full scan 发生的条件:

1. 必须是组合索引。2. 引导列不在 where 条件中

 

index skip scan (索引跳跃式扫描)

当查询可以通过组合索引得到结果,而且返回结果很少,并且 where 条件中没有包含索引引导列的时候,可能执行 index skip scan

索引跳跃式扫描发生的条件:

1. 必须是组合索引。

2. 引导列没有出现在 where 条件中

 

下面通过一个简单的实验验证一下上诉理论:

SQL> create table test as select * from dba_objects;

表已创建。

SQL> create unique index ind_id on test (object_id);    ind_id 是唯一索引

索引已创建。

SQL> create index ind_owner on test (owner);             ind_owner 是非唯一索引

索引已创建。

SQL> create index ooo on test (owner,object_name,object_type);  ooo 是组合索引

索引已创建。

SQL> exec dbms_stats.gather_table_stats(''ROBINSON'',''TEST'');

PL/SQL 过程已成功完成。

SQL> set autot trace
SQL> select owner from test where object_id=10;
执行计划
----------------------------------------------------------
Plan hash value: 2544773305

--------------------------------------------------------------------------------------
| Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |        |     1 |    11 |     2   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| TEST   |     1 |    11 |     2   (0)| 00:00:01 |
|*  2 |   INDEX UNIQUE SCAN         | IND_ID |     1 |       |     1   (0)| 00:00:01 |
--------------------------------------------------------------------------------------

SQL> select owner from test where object_id<10;

已选择 8 行。
执行计划
----------------------------------------------------------
Plan hash value: 1361604213

--------------------------------------------------------------------------------------
| Id  | Operation                   | Name   | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |        |     7 |    77 |     3   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| TEST   |     7 |    77 |     3   (0)| 00:00:01 |
|*  2 |   INDEX RANGE SCAN          | IND_ID |     7 |       |     2   (0)| 00:00:01 |
--------------------------------------------------------------------------------------

对于唯一索引,发生 index range scan 的时候就是返回多行记录,where 后面有 >,<,between ..and..

SQL> select owner from test where owner=''SCOTT'';

已选择 13 行。
执行计划
----------------------------------------------------------
Plan hash value: 2280863269

------------------------------------------------------------------------------
| Id  | Operation        | Name      | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------
|   0 | SELECT STATEMENT |           |  2936 | 17616 |     7   (0)| 00:00:01 |
|*  1 |  INDEX RANGE SCAN| IND_OWNER |  2936 | 17616 |     7   (0)| 00:00:01 |
------------------------------------------------------------------------------

对于非唯一索引,即使 where 后面的限制条件是 =, 但是有可能返回多行,所以进行 index range scan

SQL> select object_name,object_type from test where owner=''ROBINSON'';

已选择 15 行。
执行计划
----------------------------------------------------------
Plan hash value: 2845720098


-------------------------------------------------------------------------
| Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------
|   0 | SELECT STATEMENT |      |  2936 |   114K|    23   (0)| 00:00:01 |
|*  1 |  INDEX RANGE SCAN| OOO  |  2936 |   114K|    23   (0)| 00:00:01 |
-------------------------------------------------------------------------

因为 000 不是唯一索引,而且 where 后面用到了索引 ooo 的引导列,所以进行 index range scan.

SQL> select owner, object_name,object_type from test where object_name=''EMP'' ;
执行计划
----------------------------------------------------------
Plan hash value: 1799988433

-------------------------------------------------------------------------
| Id  | Operation        | Name | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------
|   0 | SELECT STATEMENT |      |     2 |    80 |    19   (0)| 00:00:01 |
|*  1 |  INDEX SKIP SCAN | OOO  |     2 |    80 |    19   (0)| 00:00:01 |
-------------------------------------------------------------------------


因为查询所需要的信息可以通过索引 ooo 获得,并且 where 后面没有引导列 owner,而且返回的行数很少 (这里只有一行),所以 CBO 选择 index skip scan, 这里 autotrace 没有显示返回多少行,下面显示一下

SQL> set autot off
SQL> select owner, object_name,object_type from test where object_name=''EMP'' ;

OWNER                          OBJECT_NAME          OBJECT_TYPE
------------------------------ -------------------- -------------------
SCOTT                          EMP                  TABLE

SQL> select owner, object_name,object_type from test where object_type=''INDEX'';

已选择 1701 行。
执行计划
----------------------------------------------------------
Plan hash value: 3464522019

-----------------------------------------------------------------------------
| Id  | Operation            | Name | Rows  | Bytes | Cost (%CPU)| Time     |
-----------------------------------------------------------------------------
|   0 | SELECT STATEMENT     |      |  1721 | 68840 |    70   (3)| 00:00:01 |
|*  1 |  INDEX FAST FULL SCAN| OOO  |  1721 | 68840 |    70   (3)| 00:00:01 |
-----------------------------------------------------------------------------

因为查询所需的信息可以通过索引 ooo 获得,并且 where 后面没有引导列 owner, 而且返回的行数较多 (1701 行),所以 CBO 选择 index fast full scan, 这样避免了全表扫描。

index.html 怎么导入一个top.html 和footer.html

index.html 怎么导入一个top.html 和footer.html

使用JQuery的load方法吧!
/*导入页面*/
$(document).ready(function(){
        $(".top").load("top.html");
        $(".footer").load("footer.html");
});
把这段代码写入到js文件里,例如headfoot.js,在需要的页面导入这个js文件即可 !

当然记得要先导入JQuery,同时要找对头尾的页面路径!

关于我的 nextjs 应用程序中没有 index.html 文件 Netlify 不喜欢那样nexturl的介绍已经告一段落,感谢您的耐心阅读,如果想了解更多关于CI框架去除indexphp excel index index finger z index、graphql 在本地工作但不在 Netlify (Gatsby + Netlify CMS)、index range scan,index fast full scan,index sk...、index.html 怎么导入一个top.html 和footer.html的相关信息,请在本站寻找。

本文标签: