Re: Customizing HTML footer

Posted by mojavelinux on
URL: https://discuss.asciidoctor.org/Customizing-HTML-footer-tp462p477.html

Costin and Rob,

As is always the case, you can solve pretty much any rendering need in Asciidoctor by supplying your own template. In this case, you might grab one of the document templates from the asciidoctor-backends repository (be sure to use the 0.1.3 branch) [1] (e.g., document.html.slim, document.html.haml, document.html.erb).

Let's assume you are using document.html.slim. You hack it up as needed, put it into the directory asciidoctor-templates/slim/html5 somewhere in the project and tell Asciidoctor to find it by passing template_dir = "asciidoctor-templates/slim" to the Asciidoctor task. It will discover the document template and use it in place of the built-in one.

(Overriding the document template will be simplified once partials are introduced; see https://github.com/asciidoctor/asciidoctor/issues/573)


Modifying the footer content is common enough that we decided to provide simpler mechanisms for customizing it in Asciidoctor 0.1.4. To disable the "Last Updated" text outright, you pass a negated attribute:

last-update-label!

You could also trick the label into displaying additional text before it emits the modified time by setting it as follows:

last-update-label="**Whatever you want here** Last Updated:"

Another approach to custom text is to include a docinfo-footer file, also introduced in 0.1.4. It works exactly the same as the docinfo files in AsciiDoc, except you name it with the -footer.{ext} suffix (e.g., docinfo-footer.html). The contents of that file go into the footer div at the bottom of the page.

Fortunately, you don't have to wait long for 0.1.4. We are working to get it out this week!

Btw, the header and footer on the asciidoctor.org pages comes from the site generation tool, Awestruct. Asciidoctor is only rendering the body content using embedded rendering mode.

-Dan

[1] https://github.com/asciidoctor/asciidoctor-backends/blob/asciidoctor-v0.1.3/slim/html5/document.html.slim



On Mon, Aug 19, 2013 at 11:40 AM, rwinch [via Asciidoctor :: Discussion] <[hidden email]> wrote:
I'm also wanting to do something similar with the gradle plugin. Issue 486 seems to indicate that asciidoctor won't support customizing the footer until 0.1.4 [1]. For that reason, I'm guessing you will need to customize the template until the next release. It may be possible for this to work with asciidocotor v0.1.4.preview.3, but I haven't had time to verify this (or determine exactly how to do it).

[1] https://github.com/asciidoctor/asciidoctor/issues/486

Cheers,
Rob Winch


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Customizing-HTML-footer-tp462p467.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | http://google.com/profiles/dan.j.allen