已部署的页面加载但不显示 - 使用 gatsby 构建
deployed page loads but does not show - built with gatsby
我将自己制作的 gatsby 博客部署到 github 页。第一页 links 到博客文章。单击 link 时没有任何显示。但是,如果我手动输入 url(相同的 url 即 linked),我会看到该页面半秒钟,然后它就会消失为空白页面。
有用的信息
- 网络选项卡中的所有内容都是状态代码 200
- 在get请求中返回HTML,在response中可见
- head 标签在页面上正确,body 标签缺少 html
- 没有控制台错误
- 在开发服务器(本地主机)上完美运行
- 域由 domain.com
托管
- 使用createpage gatsby插件生成文章页面
- 当我在 netlify 上随机部署时它有效 url 所以可能与我的域或 gh-pages 部署有关
看了你的 GitHub 代码后,我认为你这里有问题:(错误 URL: /blog/blog/why-gatsby
),而且你的主代码与 gh 的代码不匹配-pages(我知道它是从 gatsby build 生成的文件,但还有其他东西)。另外,为什么要在 index.js 组件中创建静态查询?您可以通过常规页面查询来做到这一点。
您的 gatsby 站点从 https://www.ragith.com/blog/ 开始,这就是您遇到此类问题的原因。当 gatsby 查看页面时,里面只有 blog.js
。
I.E:
pages/blog.js
Link问题
<a class="article-card-link" href="/blog/blog/why-gatsby"><section><article><h2 class="article-title">Why Gatsby js ?</h2><p class="article-date">May 09, 2020</p><p class="article-excerpt">In a world with so many JavaScript frameworks such as React, Vue, heck even Next, why Gatsby? The short answer is, none of those frameworks are the target market of Gatsby. Gatsby is a static website generator. Great! Wait, who cares? Well a lot of my clients and so will yours…</p>READ MORE</article></section></a>
我将自己制作的 gatsby 博客部署到 github 页。第一页 links 到博客文章。单击 link 时没有任何显示。但是,如果我手动输入 url(相同的 url 即 linked),我会看到该页面半秒钟,然后它就会消失为空白页面。
有用的信息
- 网络选项卡中的所有内容都是状态代码 200
- 在get请求中返回HTML,在response中可见
- head 标签在页面上正确,body 标签缺少 html
- 没有控制台错误
- 在开发服务器(本地主机)上完美运行
- 域由 domain.com 托管
- 使用createpage gatsby插件生成文章页面
- 当我在 netlify 上随机部署时它有效 url 所以可能与我的域或 gh-pages 部署有关
看了你的 GitHub 代码后,我认为你这里有问题:(错误 URL: /blog/blog/why-gatsby
),而且你的主代码与 gh 的代码不匹配-pages(我知道它是从 gatsby build 生成的文件,但还有其他东西)。另外,为什么要在 index.js 组件中创建静态查询?您可以通过常规页面查询来做到这一点。
您的 gatsby 站点从 https://www.ragith.com/blog/ 开始,这就是您遇到此类问题的原因。当 gatsby 查看页面时,里面只有 blog.js
。
I.E:
pages/blog.js
Link问题
<a class="article-card-link" href="/blog/blog/why-gatsby"><section><article><h2 class="article-title">Why Gatsby js ?</h2><p class="article-date">May 09, 2020</p><p class="article-excerpt">In a world with so many JavaScript frameworks such as React, Vue, heck even Next, why Gatsby? The short answer is, none of those frameworks are the target market of Gatsby. Gatsby is a static website generator. Great! Wait, who cares? Well a lot of my clients and so will yours…</p>READ MORE</article></section></a>