In Jekyll is there an easy way to change an output path for a folder with html

I am using Jekyll for some static site templates and I have a folder of product html pages which I want to be bundled into the root site/ folder rather than into a site/products folder.

example below with just 2 product pages:

src folder

  • src/products/123.html
  • src/products/146.html

output to site

  • site/123.html
  • site/146.html

Is there an easy way to do this?

Additionally would there be an easy way to append products- to each file in this folder?

  • site/product-123.html
  • site/product-146.html

Answers


Try looking into Jekyll collections. You'll specifically want the Permalink feature. Hopefully the following snippet will get you started.

config.yml

collections:
  products:
    output: true
    permalink: /product-:title/

source tree

_products
    |
    1.html
    2.html
    3.html
    ...

output tree

_site
    |
    product-1
        |
        index.html
    product-2
        |
        index.html
    product-3
        |
        index.html
    ...

This creates the "pretty permalinks" structure where file endings are removed by using index.html within a directory of the correct name. Of course you could set it to create the "ugly permalinks" (project-1.html, etc), but I like this style more.


Need Your Help

Access Control List per row in table

sql sql-server database-design acl

I have a tasks table on the cloud and I want users to be able share their tasks with others. I need to be able to tell which users can read each given row.