Caradepato
Caradepato

Reputation: 85

defining Directory specific permalinks in the config file in jekyll

Im working on a site using jekyll. I want to change the url of all pages in a directory without having to write permalink: url in every front matter.

I have a directory jobs in pages

 pages
    jobs
       example.markdown
       otherexample.markdown

I want all pages in jobs to have the url /talent/filename. I saw this and tried this:

defaults:
-
   scope:
      path: 'pages/jobs'
      type: 'pages'
   values:
      permalink: 'talent/:slug'

The result in the _site directory was this:

 Talent
    :slug
        index.html

with the other pages just vanishing entirely. I have tried a number of the variables listed here, with similar results. Does anyone know what is going on?

thank you.

Upvotes: 0

Views: 315

Answers (1)

michaPau
michaPau

Reputation: 1648

You forgot a trailing slash '/' in the path.

the example below should give you the desired generated output.

if you have set permalink: pretty globally it would create a folder for each title with an index.html inside

if not just the files like yourtitle.html

defaults:
-
   scope:
      path: "pages/jobs"
      type: "pages"
   values:
      permalink: /talent/:basename.html

Upvotes: 0

Related Questions