【问题标题】:Jekyll site not rendering markdownJekyll 网站不渲染降价
【发布时间】:2017-04-27 01:58:48
【问题描述】:

我的远程存储库已更新,但我的 Github 页面站点不会更新。 http://balassit.github.io/readings/GitNotes.md 的内容已过时。我已经验证了在我的 Github 设置中,我的网站是从 master 构建的。 master 上的内容与我的本地分支是最新的。

我使用jekyll build 和jekyll serve 在本地运行我的网站。这会在 localhost:4000 上产生预期的输出。

我看过一些帖子,因为 kramdown 格式,markdown 在 jekyll 页面中呈现问题,但这对我来说似乎不是问题。

https://github.com/balassit/balassit.github.io/tree/master

GitNotes.html YAML 块

---
layout: markdown
title: "Readings"
id: "readings"
custom_css: readings/github-markdown.css
---

github-markdown.css 来自https://github.com/sindresorhus/github-markdown-css/blob/gh-pages/github-markdown.css

head.html

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">

<link rel="stylesheet" href="{{ site.baseurl }}/css/normalize.css">
<link rel="stylesheet" href="{{ site.baseurl }}/css/main.css">

<!-- Custom CSS and JavaScript -->

{% for css_file in page.custom_css %}
<link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/{{ css_file }}">
{% endfor %}

{% for js_file in page.custom_js %}
<script src="{{ site.baseurl }}/{{ js_file }}"></script>
{% endfor %}

{% for js_file in page.source_js %}
<script src="{{ js_file }}"></script>
{% endfor %}

<title>{{ page.title }}</title>
</head>

markdown.html

<!DOCTYPE html>
<html>
{% include head.html %}

<body>
    <style>
    .markdown-body {
        box-sizing: border-box;
        min-width: 200px;
        max-width: 1080px;
        padding: 45px;
    }
    </style>
    {% include header.html %}

    {% include sidebar.html %}

    <main>
        <article class="markdown-body">
            <markdown>
                {{ content }}
            </markdown>
        </article>
    </main>
    {% include footer.html %}
    <script src="https://spikespaz.github.io/tagdownjs/scripts/tagdown.min.js"></script>
</body>
</html>

底部脚本是tagdown的,可以在http://spikespaz.com/tagdownjs/看到

【问题讨论】:

    标签: markdown jekyll github-pages


    【解决方案1】:

    GitNotes.md 没有 YAML Front Matter,但 GitNotes.html 有。为什么两个文件具有相同的filename?

    将 Front Matter 添加到 GitNotes.md 会将其处理到 _site/GitNotes.html

    【讨论】:

    • 我在工作时使用了 GitNotes.md 作为原始文件。这就是同名的原因。我刚刚删除它并且它有效。谢谢您的帮助。为什么这两个文件会冲突?
    • 只有当它们都包含 Front matter 但没有不同的permalink 定义时,它们才会相互冲突。在这种情况下,它们都将被处理成_site/GitNotes.html,一个覆盖另一个。如果他们都没有frontmatter,那么没有frontmatter的只会被逐字复制到_site而不被处理。
    • P.S.如果答案完全解决了您的问题,您需要接受它以将此问题标记为已解决
    猜你喜欢
    • 2023-03-16
    • 1970-01-01
    • 2015-06-23
    • 2020-12-13
    • 2021-10-07
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    相关资源
    最近更新 更多