You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jekyll使用Minima主题移除RSS订阅链接后首页无法自动更新新文章的解决方案

Jekyll使用Minima主题移除RSS订阅链接后首页无法自动更新新文章的解决方案

嘿,我来帮你搞定这个问题!你的核心问题其实是自定义home布局时没保留Minima主题原有的文章循环逻辑——你只删掉了RSS订阅的代码,但把自动加载新文章的关键部分也弄丢了,所以新发布的文章才不会显示在首页。

下面是正确的解决步骤:

  1. 确保你的项目根目录已经有_layouts/home.html文件(你已经创建了,这步没问题)。
  2. 把Minima主题默认的首页布局代码完整复制进去,然后只删除RSS订阅相关的段落。完整的代码应该是这样的:
---
layout: default
---

<div class="home">
  {%- if page.title -%}
    <h1 class="page-heading">{{ page.title }}</h1>
  {%- endif -%}

  {{ content }}

  {%- if site.posts.size > 0 -%}
    <h2 class="post-list-heading">{{ page.list_title | default: "Posts" }}</h2>
    <ul class="post-list">
      {%- for post in site.posts -%}
      <li>
        {%- assign date_format = site.minima.date_format | default: "%b %-d, %Y" -%}
        <span class="post-meta">{{ post.date | date: date_format }}</span>
        <h3>
          <a class="post-link" href="{{ post.url | relative_url }}">
            {{ post.title | escape }}
          </a>
        </h3>
        {%- if site.show_excerpts -%}
          {{ post.excerpt }}
        {%- endif -%}
      </li>
      {%- endfor -%}
    </ul>

    <!-- 把这段RSS订阅的代码删掉或者注释掉就好了 -->
    <!-- <p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | relative_url }}">via RSS</a></p> -->
  {%- endif -%}
</div>
  1. 保存文件后,重新运行jekyll serve或者jekyll build,你会发现新文章能自动显示在首页,同时RSS订阅的链接也消失了。

另外要提醒你:绝对不要修改_site文件夹里的内容!这个文件夹是Jekyll自动生成的静态站点文件,每次构建都会被完全覆盖,所有自定义操作都应该在项目根目录的文件(比如_layouts、_includes这些文件夹)里进行,这样修改才会被永久保留。

备注:内容来源于stack exchange,提问作者shubhamingaleiitb

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.16 11:05:31