How to use: author in jekyll permalink structure for github pages

I have a jekyll / ruby ​​blog on github pages where I would like the user to submit content.

In the first question of each markdown file, I would like users to be able to provide their username:

--- title: some title author: bobby-tables --- 

I would like to use this to generate a permalink to the message /:author/:title/ I have this set in my _config.yml file.

But actually :author appears in the url and seems ignored / not converted

I know this works with :categories , but it is not semantically correct and confusing for some bloggers and novice users.

Is there a way to use :author ?

The site is hosted on github pages, so I cannot use any plugins since I cannot create _site locally for every update from my home machine.

I have looked at the documentation on jeykllrb.com, but cannot see how :author used / mentioned especially in template tags.

It is also impractical to have permalinks: name/title in front for each markdown file.

Thanks in advance.

+4
source share
1 answer

I just did some tests, and I cannot get any user variables in the first question to be interpreted as part of the permalink.

Looking through the code, I can understand (new to ruby), it only accepts the ones listed here http://jekyllrb.com/docs/permalinks/

At the moment, depending on your categories or workflow tags, this is the only option, since you can use plugins. If categories do not make sense semantically, then perhaps use a tag and explain that they are tagged in the messages they wrote.

+2
source

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


All Articles