Skip to content

Commit

Permalink
docs: add docs for setting ToC
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-sid committed Sep 23, 2023
1 parent 1b64dc1 commit 136be24
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions exampleSite/content/posts/table-of-content/index.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
---
title: How to enable table of content
title: Table of content
date: 2023-05-02
description: Setup table of content in Hugo blog awesome theme
---

## Table of content

This theme supports displaying table of content in blog posts.
This theme supports displaying table of content (ToC) in blog posts.

To enable it, globally set `toc` to `true` in `config.toml`:
## Enable table of content on all posts

To enable ToC on all posts (globally) set parameter `toc` to `true` in `config.toml`.

```toml
[params]
toc = true
```

This will enable table of content for all posts. If you want to enable it for a specific post, add `toc = true` to the front matter of the post:
To disable ToC globally, simply ignore the `toc` parameter or set it to `false`.

## Disable table of content on certain posts

```yaml
---
title: How to enable table of content
date: 2023-05-02
toc: true
---
```
To disable ToC on certain posts, you have to follow two steps.

1. Set parameter `toc` to `true` in `config.toml`.

```toml
[params]
toc = true
```

2. Add `toc = false` to the front matter of the post for which you wish to disable ToC.

```yaml
---
title: How to enable table of content
date: 2023-05-02
toc: false
---
```

0 comments on commit 136be24

Please sign in to comment.