Permalink variables not working

Hi there!

I’m currently having issues setting up permalinks on a group of pages on my jekyll site using defaults in _config.yml.

Essentially I’m trying to map pages in directories like docs/v1/some-article.md to a url like /someArticle (masking away the docs/v1). Here’s my _config.yml:

defaults:
  - scope:
      path: docs/v1
    values:
      permalink: /:slug/

And a page with some front-matter:

docs/v1/some-page.html:

---
layout: page
title: Some Page
slug: somePage
---
Some content

I’m expecting the compiled result to yield a URL of /somePage, however instead Jekyll is rendering it as /:slug/index.html (it’s not parsing the permalink template variable).

Any ideas as to what I’m doing wrong here? Thanks in advance!

1 Like

try switching it to permalink: /:title/ just to see if it works. It should, and then I think the problem will be that /::slug is not available in that context?

Hmm, setting permalink: /:title/ yields this output in _site:

/title
    index.html

Interesting how it stripped out the : from the directory name…

Also note that setting permalink to /:title yields one file named /title.html. Very strange behavior here. Any ideas?

I believe that is correct behavior.

I am not clear on what you mean by using title in your output example - are you saying that literally the name you see is title? rather than the actual title?

Not sure what you mean, there should not be a colon in the directory name.

I’m not sure we are talking about the same things.

Here’s what the output looks like if I set the default permalink: /:title/:

I’m not even sure how it’s possible that there is a / in the directory name (I thought that wasn’t allowed?).

ah, maybe it is not possible to do that type of syntax in the defaults?

this is a little old, and I want to say the other day that I saw something where someone did do what you wanted and it works - I think that was on stackoverflow, I’ll see if i can find that again.

what version of jekyll are you using?