我希望通过使用这里的
这个插件在我的本地环境下运行得非常好,但是在GitHub上无法正常工作。
我发现GitHub主机上的导航栏是空的,似乎这个插件没有起作用。
我该如何解决这个问题?
我复制了
jekyll-plugins/weighted_pages.rb
来改变导航栏中页面的顺序。这个插件在我的本地环境下运行得非常好,但是在GitHub上无法正常工作。
我发现GitHub主机上的导航栏是空的,似乎这个插件没有起作用。
我该如何解决这个问题?
我复制了
weighted_pages.rb
的代码如下:# Generates a copy of site.pages as site.weighted_pages
# with pages sorted by weight attribute. Pages with no
# weight specified are placed after the pages with specified weight.
module Jekyll
class WeightedPagesGenerator < Generator
safe true
def generate(site)
site.config['weighted_pages'] = site.pages.sort_by { |a|
a.data['weight'] ? a.data['weight'] : site.pages.length }
end
end
end
在你的页面的前置数据中添加weight
属性(例如weight: 1
),并在循环中使用site.weighted_pages
代替site.pages
。
_site
文件夹无法上传,我该怎么办? - Mithril_site
文件夹的内容,这样你就可以简单地推送静态站点。一种简单的方法是将.git/
文件夹移动到_site
文件夹中,提交并推送这些更改。之后,按照通常的方式生成网站,然后从_site
文件夹中推送更改到 GitHub。 - Andión