【问题标题】:Cannot link posts on blog for github无法为 github 链接博客上的帖子
【发布时间】:2017-01-17 17:38:31
【问题描述】:

在我的 github 页面上,我在顶部有一个名为项目的选项卡,其中列出了一堆我的项目。我在顶部创建了第二个名为“倡议”的选项卡,但是我无法填写我的倡议。

好的,问题是 _postsi 没有在 _config.yml 中定义,有人知道我该怎么做吗?

我的 projects.md 调用我的 _posts 文件夹(我在其中列出了项目),我正在尝试让我的 Initiatives.md 调用我的 _postsi 文件夹(我在那里有填充计划)

https://github.com/tusharjoshi1/tusharjoshi1.github.iowww.tusharjoshi1.com

【问题讨论】:

    标签: html git github jekyll jekyll-bootstrap


    【解决方案1】:

    听起来您想为帖子使用单独的类别。即,您会将您的项目和计划划分为单独的类别。

    root
     | -- index.html
     | -- _posts
          | -- projects
               | -- 2014-12-02-Calculating-Molar-Values-Using-VBA.md
               | -- 2015-05-27-Air-Flow-Measurements.md
          | -- initiatives
               | -- 2015-02-13-hamlet-monologue.md
               | -- 2015-02-26-flake-it-till-you-make-it.md
    

    然后对于您的页面,您将引用该类别。

    {% for poem in site.categories.initiatives %}
      {{ initiative.output }}
    {% endfor %}
    

    Here's 包含此问题的链接以获取更多信息。

    另外,当我发现 Hamlet Monologue.md 文件没有包含 Hamlet 的独白时,我有点失望...... 这出戏才是重点 在哪里我会抓住国王的良心。

    【讨论】:

    • 按类别我只需要在_posts 中放置一个名为projects and Initiatives 的文件夹吗?或者我必须在 config.yml 中更改什么?
    【解决方案2】:

    在您希望在“倡议”选项卡下显示的帖子的前面事项中设置类别“倡议”后,将 Initiative.md 中的代码更改为以下

    Currently Being Updated.
    <ul>
      {% for post in site.categories['initiatives'] %}
        <div>
          <a href="{{ post.url }}">{{ post.title }}</a>
          {{ post.excerpt }}
        <hr>
        </div>
      {% endfor %}
    </ul>
    

    注意 Initiatives.md 中的以下行

    {% for post in site.categories.initiatives %}

    应该改为

    {% for post in site.categories['initiatives'] %}

    【讨论】:

    • 按类别我只需要在_posts 中放置一个名为projects and Initiatives 的文件夹吗?或者我必须在 config.yml 中更改什么?
    • 我不认为这对你有用。您在您的倡议文件夹中的所有帖子中的头条内容 - 例如:2015-02-13-hamlet-monologue.md 有一个名为“倡议”的类别,您在 Initiative.md 中的代码指的是 {% for post in site.categories ['倡议'] %}。将帖子中的类别更改为类别:倡议或将配置文件中的代码更改为 {% for post in site.categories['initiative'] %}
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-07-02
    • 1970-01-01
    • 2023-03-27
    • 2012-11-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多