如何将带有站点导航的通用页面标题添加到asciidoc文档? [英] How can I add a generic page header with site navigation to an asciidoc document?

查看:67
本文介绍了如何将带有站点导航的通用页面标题添加到asciidoc文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用asciidoctor建立一个基本的文档站点.我苦苦挣扎的一件事是如何将标准的网站标题(带有徽标和顶层导航的横幅)注入每个文档页面.

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.

我从命令行直接将asciidoc渲染为html.我试图找到一种方法,以某种方式注入一个额外的 div 元素并将其固定在顶部,但是我不知道该使用哪种机制.我早期的尝试涉及使用 docinfo.html ,但是它被注入到< head> 元素的html中,而不是< body> .

I render my asciidoc directly to html from the command line. I have tried to find a way to somehow inject an extra div 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 docinfo.html but that gets injected into the html in the <head> element, instead of the <body>.

我知道像Jekyll这样的功能全面的发布系统使我可以配置可以解决此问题的前沿问题",但是我希望有一种机制或技巧可以使用香草味抗坏血酸来实现这一目标.

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 演示网站仅使用Asciidoctor创建.

Demo website created just using Asciidoctor.

检查相应的仓库,以查看文件以及如何创建站点(仅使用一个命令)

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

总之:只需创建一个包含您的站点导航的头文件asciidoc文件(在演示站点中,这是使用表标记完成的),不包含,包括一个0级(文档)标题.在您网站的每个页面的顶部,都包含此头文件.然后通过在项目上运行 asciidoctor * .txt 进行渲染.

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.

这篇关于如何将带有站点导航的通用页面标题添加到asciidoc文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆