Jekyll导航 - 如何排除页面

时间:2018-03-17 02:30:04

标签: jekyll

嘿,所以我建立了一个多语言网站,我只希望某些页面显示在顶部导航中,但它们会在导航中显示

这就是我在header.html中的内容

{% assign pages = site.pages | sort: "nav-order" %}
{% for p in pages %}
  {% if p.language == page.language %}
    <li><a class="tx--upper {% if p.url == page.url %}is-active{% endif %}" href="{{ p.url | prepend: site.baseurl }}">{{ p.title }}</a></li>
  {% endif %}
{% endfor %}

这就是我在yaml fontmatter中为我希望在顶部导航中显示的页面(about.html)

---
title: About
language: en
nav-order: 1
---

这就是我在页面上的内容,我不想在顶部导航中显示(404.html)

---
language: en
nav-order: 
---

但显示我可以检查nav-order是否为空,不显示在顶部导航中?我已经尝试了if语句来检查分配pages !== null,并且还排除了我在网上找到的内容,但没有任何效果。

HELP enter image description here

1 个答案:

答案 0 :(得分:1)

如果您只想打印带有<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/animate.css@3.5.2/animate.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <ul id = "demo" style="position: fixed;bottom:0" ></ul>设置的页面,您可以像这样补充您的条件:

nav-order: