Jekyll - 我如何在根目录下创建页面? [英] Jekyll - How do I create pages in the root directory?

查看:363
本文介绍了Jekyll - 我如何在根目录下创建页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Jekyll创建页面,文档建议Jekyll可以选择在根目录中创建页面,或为新页面创建新目录。

通过 http://jekyllrb.com / docs / pages /


您将HTML文件放入页面的位置取决于您希望页面的位置
工作。有两种主要的创建页面的方法:


  • 在网站的根文件夹中为每个页面放置命名的HTML文件。

  • 在每个网页的网站根目录中创建一个文件夹,并在每个网页文件夹中放置一个
    index.html文件。


< blockquote>

 项目
- _includes
- _site
----约
------ index.html
----资产
------ css
------ img
------ ------ js
- 资产
---- css
---- img
---- js
- _config.yml
- about.html
- index.html

如何配置Jekyll以创建页面根目录?

解决方案

如果您创建了 about.html 你的Jekyll文件夹,它会在 _site / about.html 中生成,除非你把



默认情况下,关于页面有一个永久链接(永久链接:/ about / _site / about / index.html 中生成。



使用永久链接,您甚至可以执行:


  • 页面位于 pages / mypage.html

  • 永久链接:my-nice-page.html
  • _site / my-nice生成的



注意:如果您设置全局 code> _config.yml 漂亮,所有页面都会生成,以便为漂亮的网址 http://domain.tld/about/ (位于 _site / about / index.html )。您可以将此变量更改为日期或其他值,或者在页面中放置固定链接以覆盖全局链接。


I'm using Jekyll to create a page and the docs suggest that Jekyll has the option to create pages in the root directory, or to create new directories for new pages.

From http://jekyllrb.com/docs/pages/

Where you put HTML files for pages depends on how you want the pages to work. There are two main ways of creating pages:

  • Place named HTML files for each page in your site’s root folder.
  • Create a folder in the site’s root for each page, and place an index.html file in each page folder.

project
-- _includes
-- _site
---- about
------ index.html
----assets
------ css
------ img
------ js
--assets
---- css
---- img
---- js
-- _config.yml
-- about.html
-- index.html

How do I configure Jekyll to create pages in the root directory?

解决方案

If you create an about.html page at the root of you Jekyll folder, it will generated in _site/about.html except if you put a permalink in the front matter.

By default the about page has a permalink (permalink: /about/) it is then generated in _site/about/index.html.

With permalink you can even do :

  • page in pages/mypage.html
  • permalink: my-nice-page.html
  • generated at _site/my-nice-page.html

Note: If you set your global permalink in _config.yml to pretty, all pages will be generated in order to give pretty urls like http://domain.tld/about/ (in _site/about/index.html). You can the change this variable to date or other or put a permalink in your page to override the global one.

这篇关于Jekyll - 我如何在根目录下创建页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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