Open keilw opened 3 years ago
Yeah that's possible, you'll want to do something similar to this: https://github.com/jbake-org/jbake-example-project-freemarker/blob/master/templates/header.ftl#L5
Here is an example of doing that exact way -
<span class="author"/><span class="name">${post.author!config.site_author}</span><img src="${content.rootpath}${post.author_avatar!config.site_author_avatar}" alt="${post.author!config.site_author}" /></span>
Freemarker has an elvis operator (AKA defaultIfNull operator), here's how I use it in my base.ftl:
<link content="${(content.canonical_url)!config.canonicalBaseUrl + "/" + content.uri}" rel="canonical">
At the moment every post has just one author based on the
meta.author
property. Would it be possible to also have an (optional) property on a post likeauthor=<authorname>
that is used where present and if not given, the default author from the metadata is used instead?