Skip to content

Instantly share code, notes, and snippets.

@skempken
Last active March 17, 2022 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save skempken/5b52fed443b923e42e016f1aeb12bc98 to your computer and use it in GitHub Desktop.
Save skempken/5b52fed443b923e42e016f1aeb12bc98 to your computer and use it in GitHub Desktop.
Supplemental UI partials to have Antora Default UI show author bylines
# snippet
ui:
supplemental_files:
# adds byline
- path: partials/article.hbs
contents: ./supplemental-ui/partials/article.hbs
- path: partials/byline.hbs
contents: ./supplemental-ui/partials/byline.hbs
<article class="doc">
{{#with page.title}}
<h1 class="page">{{{this}}}</h1>
{{/with}}
{{> byline}}
{{{page.contents}}}
{{> pagination}}
</article>
{{#with (resolvePage page.relativeSrcPath model=false)}}
{{#unless (eq ./asciidoc.attributes.author undefined)}}
<div class="byline">
{{#if (eq ./asciidoc.attributes.email undefined)}}
<address class="author">By {{./asciidoc.attributes.author}}</a></address>
{{else}}
<address class="author">By <a rel="author" href="mailto:{{./asciidoc.attributes.email}}">{{./asciidoc.attributes.author}}</a></address>
{{/if}}
</div>
{{/unless}}
{{/with}}
@skempken
Copy link
Author

skempken commented Mar 17, 2022

Example on how to produce a semantic HTML5 byline section with Antora's Default UI based on an author line in the AsciiDoc document:

= Page Title
Firstname Lastname <mail@domain.example>

Based on the suggested workaround in https://gitlab.com/antora/antora/-/issues/355

The above files would need to be put in partials/ and added as supplement to the default ui. See antora-playbook.yml-Snippet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment