【发布时间】:2018-08-13 10:00:39
【问题描述】:
我使用存储在包含目录中的以下公式生成页面速率“Indexmod”
{% assign number_of_words = content | strip_html | number_of_words %}
{% assign social = page.facebook | plus: page.instagram | plus:
page.youtube | plus: page.vimeo | plus: page.vkontakte | plus:
page.twitter | plus: page.tumblr | plus: page.youtube %}
{% assign age = site.time | date: "%Y" | minus: page.birth %}
{% assign index = age | times: social | divided_by: 1000000.0 %}
{% assign indexmod = index | times: number_of_words | divided_by: 100 %}
{{ indexmod | round: 2 }}
然后我在网站主页上的每个页面主题旁边插入“Indexmod”速率值:
{% assign mypages = site.pages | sort: "order" %} {% for page in
mypages %}
{% unless page.exclude %}
<a href="{{page.url|absolute_url | remove: "/assets/css/style.css" |
remove: "/redirects.json" | remove: "/sitemap.xml" | remove:
"/robots.txt" | remove: "/feed.xml"}}"> {{ page.shortname }} <span
class="rate">{% include indexmod.html %}</a></span> <span class="rex">
| </span>
{% endunless %}
{% endfor %}
因此,我看到扩展名为 .css .json .xml .txt 的不需要的文件作为页面
所以我尝试了很多技巧,例如在 front-mater 中放置一个排除行,但它不适用于这 5 个文件。
我的问题如何从 site.pages 中排除 .css .json .xml .txt。提前感谢您的关注!
【问题讨论】:
-
你有什么问题?
-
我已将问题主题编辑为:“如何从 Jekyll 的 site.pages 中排除 .css .json .xml .txt?”
-
尝试使用
site.posts而不是site.pages。