Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about jekyll #7

Closed
imba-tjd opened this issue Jun 29, 2020 · 8 comments
Closed

Questions about jekyll #7

imba-tjd opened this issue Jun 29, 2020 · 8 comments
Labels
question Further information is requested

Comments

@imba-tjd
Copy link

想问一些关于jekyll的问题,如果大佬愿意回答我就发问题,不愿意就关了吧

@iBug
Copy link
Owner

iBug commented Jun 29, 2020

欢迎提问(其实 imba-tjd 这位大佬我是认识的)

@iBug iBug added the question Further information is requested label Jun 29, 2020
@imba-tjd
Copy link
Author

_config.yml的defaults的scope的type不是很懂
根据 https://jekyllrb.com/docs/configuration/front-matter-defaults/ 它的值可以是pages, posts, drafts or any collection in your site。哪样的算posts?是只有在_posts下的才算?
pages和drafts又是什么呢?根据 https://jekyllrb.com/docs/posts/#drafts ,只要 without a date in the filename 就是drafts?

@iBug
Copy link
Owner

iBug commented Jun 29, 2020

这个地方我也不是很懂,我一般靠在模板里插入 {{ page.type }} 然后观察生成的页面来判断🙈

目前我知道的信息是,posts 是 Jekyll 内置的一个特殊的 collection(也就是它本质还是一个 collection),因此作用范围仅限 _posts 目录下的文件。Drafts 同理,即仅限 _drafts 目录。

pages 比较特殊,不属于任何一个 collection (不位于下划线开头的目录里)的文件就属于 pages。

另外插件可以主动生成额外的类型,一个例子是 Jekyll Paginate V2,参考 mmistakes/minimal-mistakes#2466

@imba-tjd
Copy link
Author

根据我的测试,我认为_drafts没有特别之处:如果不include就不会生成,include了,在_site中生成的文件夹仍然带有下划线,jekyll build加不加--drafts都是一样的效果。我能观察到的是_posts下的不含日期的文件,加--drafts时会生成,不加就不生成,看起来这样的就是drafts。

我还想知道,是不是默认会忽略以点开头的和以下划线开头的文件和文件夹?(如果不设置include和collection)。我观察到了这个现象,但是好像没有看见文档里说了这件事。

@iBug
Copy link
Owner

iBug commented Jun 29, 2020

点开头的不清楚,但是下划线开头的在 Jekyll 里是特殊文件,如果需要生成(或复制到目标目录)需要加入 _config.ymlinclude 数组,例如:

include: ["_pages"]

@imba-tjd
Copy link
Author

imba-tjd commented Jul 1, 2020

还想问一下/assets/js/main.min.js。好像如果不在footer_scripts:中添加它,f12中看不到它加载。是不是如果我不自定义js,就不用写?

@iBug
Copy link
Owner

iBug commented Jul 1, 2020

还想问一下/assets/js/main.min.js。好像如果不在footer_scripts:中添加它,f12中看不到它加载。是不是如果我不自定义js,就不用写?

这个文档里有介绍 https://mmistakes.github.io/minimal-mistakes/docs/javascript/,下面这句:

Note: If you assign footer_scripts the theme’s /assets/js/main.min.js file will be deactivated. This script includes jQuery and various other plugins that you’ll need to find replacements for and include separately.

代码在 https://github.com/mmistakes/minimal-mistakes/blob/master/_includes/scripts.html#L5

@imba-tjd
Copy link
Author

imba-tjd commented Jul 1, 2020

🆗 感谢 🚀

@imba-tjd imba-tjd closed this as completed Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants