hugoasciidocasciidoctor-pdf

Automating Frontmatter Removal: Streamlining Hugo and AsciiDoctor PDF Integration


Hugo removes the frontmatter from an Asciidoc file before passing the document to the Asciidoc processor. For example

---
title:
subtitle:
...
__

But how can I hide the frontmatter for Hugo for Asciidoctor PDF if asciidoctor-pdf is to generate the PDF? Without having to comment out the first lines?

Is there a way to automate this?

Conversely, it is possible to adapt individual parameters to Hugo in Asciidoc. See Path Predicament: Navigating Image Rendering Discrepancies Between AsciiDoctor PDF and Hugo


Solution

  • The solution is so simple: Asccidoctor-pdf only needs one additional attribute when translating an adoc file into a PDF:

    -a skip-front-matter
    

    skip-front-matter attribute