如何从Jekyll的site.pages中排除.css .json .xml .txt? [英] How to exclude .css .json .xml .txt from site.pages in Jekyll?

查看:60
本文介绍了如何从Jekyll的site.pages中排除.css .json .xml .txt?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用包含存储在包含目录中的以下公式来生成页面速率"Indexmod"

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

然后,我使用以下方法在网站主页上的每个页面主题下插入"Indexmod"费率值:

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

结果是,我看到不需要的扩展名为.css .json .xml .txt的文件作为页面

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

因此,我正在尝试使用排除行中的许多技巧,但不适用于这5个文件.

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

我的问题是如何从site.pages中排除.css .json .xml .txt.预先感谢您的关注!

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

推荐答案

我几乎通过从_config.yml中删除这些行来解决了问题

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

宝石:
-jekyll-sitemap
-怪诞的提法 -表情符号
-jekyll-redirect-from
-jekyll-feed

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

这篇关于如何从Jekyll的site.pages中排除.css .json .xml .txt?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆