Using :section variable in Front matter

Hello,

I know we are able to add variables in the site configuration for permalinks by using the following:

permalinks:
post: /:section/:year/:month/:title/

Is there any way we can make the :section, :slug, :title, etc. variables available to the url parameter in the actual posts’ front matter like the following example:

title: New Post
date: 2015-04-16
url: /:section/2015/4/16/:slug
description: Test

This will allow that a simple renaming of the section will automatically update all children rather than going in and renaming each individual post. I know this functionality can be done in the site configuration but i would like to have this option on a per post basis. There may be cases where i won’t want to use the date within the url for specific posts.

Thanks for your help

Or perhaps a way to make the url option in front matter not be relative to the root but relative to the section/parent? This could work also.

Anyone?

I only use the slug variable in the front matter of individual posts.
My configuration file contains only title, base URL and language code.

I’ve renamed sections and even moved posts to new subdirectories and nothing broke. Have you tried it?

I agree it would be useful, but a little tricky to implement, maybe … The URL will have to be resolved last (or after slug etc).

I agree, hugo new could definitely be more powerful, though it wouldn’t be too difficult to implement a custom script that mimics hugo new, parsing the archetype and filling in variables for you. If I new GoLang I would write this feature and submit a pull request. Something to do in the future, for now it might be easier for me to just write a PowerShell function saved in my local profile.

We’re happy to help you with learning Go. You’ll find that the syntax is very approachable and virtually every one of the 150+ contributors who have helped build Hugo didn’t know a single thing about Go prior to contributing. Whether it’s this feature or a different one, if you can write powershell you can definitely write Go.

spf13,

Thanks for the encouragement! I might give this a whirl here soon. Currently, my time is being taken up by learning Polymer so I can push out [my very first static blog site!][1]

I have quite a few features that I could write, given the time (the motivation already exists).