How to exclude .css .json .xml .txt from site.pages in Jekyll? [duplicate]

霸气de小男生 提交于 2019-12-13 03:14:56

问题


I am generate page rate "Indexmod" with following formula stored in include directory

{% 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 }}

Then I am inserting the "Indexmod" rate value next every page topic on main page on the site using:

{% 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 %}

As result I see unwanted files with extensions .css .json .xml .txt as pages

So am trying lot of tricks as put in front-mater an exclude line, but it does not work for these 5 files.

My question How to exclude .css .json .xml .txt from site.pages. Thank in advance for your kind attention!


回答1:


I almost fixed problem by deleting these lines from _config.yml

gems:
- jekyll-sitemap
- jekyll-mentions - jemoji
- jekyll-redirect-from
- jekyll-feed



来源:https://stackoverflow.com/questions/51819762/how-to-exclude-css-json-xml-txt-from-site-pages-in-jekyll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!