jekyll-friend
jekyll-friend

Reputation: 61

Permalink coming from the Front Matter

I'm working in Jekyll, and I want to customize the permalink of my posts, so I add this line in config.yml:

permalink: /:category/:title/

The category is the category of the post and title is its name as .md file. But suppose I want to get info from the from matter of the post: imagine the front matter of file.md is

---
title: my_title
lang: en
---

Now I want to get this title (my_title, not file) and this lang, so that I gent .../en/my_title.md. So in config.yml I should have

permalink: /page.lang/page.title/

Obviously that does not work because I'm mixing different languages. How should I do?

Upvotes: 0

Views: 58

Answers (1)

David Jacquel
David Jacquel

Reputation: 52809

You cannot use variables in the front matter.

But you can put your post in an en/ folder and have a default permalink for posts like :path/:title.

Upvotes: 1

Related Questions