Jeen Broekstra Jeen Broekstra - 3 months ago 16
CSS Question

How can I add a generic page header with site navigation to an asciidoc document?

I'm trying to build a basic documentation site using asciidoctor. One thing I am struggling with is how I can inject a standard site header (a banner with a logo and top-level navigation) into each documentation page.

I render my asciidoc directly to html from the command line. I have tried to find a way to somehow inject an extra

element and position it fixed at the top, but I can't figure out what mechanism to use for this. My early attempts involved using
but that gets injected into the html in the
element, instead of the

I am aware that full-on publication systems like Jekyll allow me to configure "front matter" that can probably take care of this, but I was hoping there was a mechanism or trick using vanilla asciidoctor that can achieve this.


Ted Bergeron on the Mailing List mentioned a simple project:

Demo website created just using Asciidoctor.

Check the corresponding repo to see the files and how to create the site (just using one command).

In summary: simply create a header asciidoc file that includes your site nav (in the demo site this is done using table markup), without including a level-0 (document) title. Include this header file right at the top in every page of your site. Then render by just running asciidoctor *.txt on your project.