Clearing URLs from pages in Jekyll user folder

I am creating a Jekyll site made of static pages (for example, nothing in the _posts directory), and instead of storing each page in the root directory, I would like to save it in the pages user directory (for the sake of organization).

However, I do not want this structure to be reflected in my URLs, so in my _config.yml I have:

permalink: /:title

With this configuration, my desired URL would be site.com/pagename , but I won’t get the page displayed unless I hit site.com/pages/pagename.html .

Can someone help me tune my build to achieve the first? Thanks!

+4
source share
2 answers

These are static pages, so the entry in _config.yml will be ignored.

From the sounds of this, you will need to create a URL rewrite rule. How to do this will depend on the web server that runs the page servers.

0
source

Have you tried adding the YAML Front Matter function to this static page? For instance:

 --- title: "pagetitle" --- 

Therefore, Jekyll should recognize it as a Page (instead of StaticPage ) and use your permalink configuration.

+1
source

Source: https://habr.com/ru/post/1497698/


All Articles