如何从导航中排除RSS(Jekyll-Feed)?

时间:2017-01-18 17:45:38

标签: jekyll

导航中没有与我的RSS订阅源的实际链接,但它在我的菜单中的另一个边框上添加了一个css border,看起来很难看。那么如何从导航中删除Feed?

jekyll-feed gem为Feed输出li

导航菜单

<nav id="menu">
    <ul class="links">
        {% for page in site.pages %}
            {% if page.layout == "home" %}
                <li><a href="{{ "" | absolute_url }}">{{ page.title }}</a></li>
            {% endif %}
        {% endfor %}
        {% for page in site.pages %}
            {% if page.layout != "home" %}
                <li><a href="{{ page.url | absolute_url }}">{{ page.title }}</a></li>
            {% endif %}
        {% endfor %}
        <div class="content">
            <ul class="actions">
                <li><a href="#contact" id="contact-btn">Contact</a></li>
            </ul>
        </div>
    </ul>
    <ul class="actions vertical">
        <li><a href="#" class="button special fit">Subscribe to Newsletter</a>
        </li>
    </ul>
</nav>

导航HTML

    <nav id="menu">
  <ul class="links">
    <li><a href="#">Home</a></li>
    <li><a href="#/about.html">about</a></li>
    <li><a href="#/archive.html">archive</a></li>
    <li>
      <a href="#/feed.xml"></a>
    </li>
    <li>
      <a href="#/feed.xslt.xml"></a>
    </li>
    <div class="content">
      <ul class="actions">
        <li><a href="#contact" id="contact-btn">Contact</a></li>
      </ul>
    </div>
  </ul>
  <ul class="actions vertical">
    <li><a href="#" class="button special fit">Subscribe to Newsletter</a>
    </li>
  </ul>
</nav>

1 个答案:

答案 0 :(得分:0)

我认为以下代码适合您:

<nav id="menu">
    <ul class="links">
        <li><a href="#">Home</a></li>
        {% for page in site.pages %}
            {% if page.layout == "home" or page.url contains ".xml" %}
            {% else %}
                <li><a href="{{ page.url }}">{{ page.title }}</a></li>
            {% endif %}
        {% endfor %}
        <div class="content">
            <ul class="actions">
                <li><a href="#contact" id="contact-btn">Contact</a></li>
            </ul>
        </div>
    </ul>
    <ul class="actions vertical">
        <li><a href="#" class="button special fit">Subscribe to Newsletter</a>
        </li>
    </ul>
</nav>

请注意,我删除了页面上的额外循环以使构建更快。我也认为不需要absolute_url语句。你确定要在ul中打开div吗?