Github 导航至 markdown 时页面仅显示 index.html 内容 link
Github Pages only show index.html contents when navigating to markdown link
我正在设置 Github 页面站点,index.html、css 等都运行良好。
当我使用语法 YYYY-MM-DD-title-of-post.md 在 _posts 中创建 .md 文件时,我可以导航到 username.github.io/YYYY/MM/DD/title-of-post 而不是收到 404,但它只显示我的 index.html 文件的内容。
这是 gh-p 的 link:https://jacobkreider.github.io
问题示例:https://jacobkreider.github.io/2018/06/12/try-again
为什么会这样?那里有我不知道的重定向或其他内容吗?我通过 Web 界面发布,但从桌面和命令行得到同样的问题。
当我尝试从我的 /blog/ 文件夹加载索引文件(以尝试查看已发布帖子的列表)时,我看到了同样的事情。
我被卡住了 - 任何帮助将不胜感激。
编辑:它似乎只是在 _layouts 文件夹下显示我的默认布局。 index.html 的更改或其他文件帖子不会在任何地方显示。
您的默认布局不输出{{ content }}
。编辑此文件以读取:
...
<div class="container">
{{ content }}
</div>
...
我查看了您网站的存储库。您在 /index.html
和 /_layouts/default.html
中有相同的代码块 <div class="blurb"> ... </div>
。您只需要 /index.html
.
中的此代码
在 /_layouts/default.html
中,将 div
替换为 {{ content }}
,使其看起来像
...
</nav>
<div class="container">
{{ content }}
</div><!-- /.container -->
<footer>
...
因为你在 /index.html
的前面指定了 layout: default
,Jekyll 使用 /_layouts/default.html
,将 /index.html
的实际内容存储在 content
变量,并使用 {{ content }}
将所有内容插入到布局中。由于您缺少 {{ content }}
,因此显示了 none 的帖子更改或 /index.html
。
我正在设置 Github 页面站点,index.html、css 等都运行良好。
当我使用语法 YYYY-MM-DD-title-of-post.md 在 _posts 中创建 .md 文件时,我可以导航到 username.github.io/YYYY/MM/DD/title-of-post 而不是收到 404,但它只显示我的 index.html 文件的内容。
这是 gh-p 的 link:https://jacobkreider.github.io
问题示例:https://jacobkreider.github.io/2018/06/12/try-again
为什么会这样?那里有我不知道的重定向或其他内容吗?我通过 Web 界面发布,但从桌面和命令行得到同样的问题。
当我尝试从我的 /blog/ 文件夹加载索引文件(以尝试查看已发布帖子的列表)时,我看到了同样的事情。
我被卡住了 - 任何帮助将不胜感激。
编辑:它似乎只是在 _layouts 文件夹下显示我的默认布局。 index.html 的更改或其他文件帖子不会在任何地方显示。
您的默认布局不输出{{ content }}
。编辑此文件以读取:
...
<div class="container">
{{ content }}
</div>
...
我查看了您网站的存储库。您在 /index.html
和 /_layouts/default.html
中有相同的代码块 <div class="blurb"> ... </div>
。您只需要 /index.html
.
在 /_layouts/default.html
中,将 div
替换为 {{ content }}
,使其看起来像
...
</nav>
<div class="container">
{{ content }}
</div><!-- /.container -->
<footer>
...
因为你在 /index.html
的前面指定了 layout: default
,Jekyll 使用 /_layouts/default.html
,将 /index.html
的实际内容存储在 content
变量,并使用 {{ content }}
将所有内容插入到布局中。由于您缺少 {{ content }}
,因此显示了 none 的帖子更改或 /index.html
。