WinterJules
WinterJules

Reputation: 93

How Do I Exclude RSS (Jekyll-Feed) From Nav?

There is no actual link to my rss feed from the nav, but it adds a css borderon top of another border in my menu, which looks ugly. So how do I remove the feed from my nav?

The jekyll-feed gem outputs an li for the feed

Nav Menu

<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>

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>

Upvotes: 3

Views: 1614

Answers (2)

Artur INTECH
Artur INTECH

Reputation: 7396

For those who is looking a way to disable feed.xml when using the default Minima gem:

There seems to be no way to fully get rid of the jekyll-feed gem as it is a dependency of the theme gem itself, but you can hide it from the generated HTML by removing {%- feed_meta -%} from _layouts/base.html.

Obviously, /feed.xml URL will still be accessible.

Upvotes: 0

Mr. Hugo
Mr. Hugo

Reputation: 12590

I think the following code should work for you:

<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>

Note that I removed the extra loop over the pages to make the build quicker. I also think the absolute_url statement is not needed. Are you sure you want to open a div inside an ul?

Upvotes: 1

Related Questions