support table of contents for Markdown posts
This commit is contained in:
parent
6b05e21804
commit
b2e8d8212a
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
title: About Hugo XMin
|
||||
author: Yihui Xie
|
||||
toc: true
|
||||
---
|
||||
|
||||
**XMin** is the first Hugo theme I have designed. The original reason that I wrote it was I needed a minimal example of Hugo themes when I was writing the [**blogdown**](https://github.com/rstudio/blogdown) book. Basically I wanted a simple theme that supports a navigation menu, a home page, other single pages, lists of pages, blog posts, categories, tags, and RSS. That is all. Nothing fancy. In terms of CSS and JavaScript, I really want to keep them minimal. In fact, this theme does not contain any JavaScript code at all, although on this example website I did introduce some JavaScript code (still relatively simple anyway). The theme does not contain any images, either, and is pretty much a plain-text theme.
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
{{ if (gt .Params.date 0) }}<h2 class="date">{{ .Date.Format "2006/01/02" }}</h2>{{ end }}
|
||||
</div>
|
||||
|
||||
{{ if .Params.toc }}
|
||||
{{ .TableOfContents }}
|
||||
{{ end }}
|
||||
|
||||
<main>
|
||||
{{ .Content }}
|
||||
</main>
|
||||
|
|
|
@ -21,6 +21,10 @@ hr {
|
|||
border-style: dashed;
|
||||
color: #ddd;
|
||||
}
|
||||
#TableOfContents, #TOC {
|
||||
border: 1px solid #eee;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
/* code */
|
||||
pre {
|
||||
|
|
Loading…
Reference in New Issue