Skip to content

Commit

Permalink
feat: Add Toc option on posts
Browse files Browse the repository at this point in the history
- Implemented for those files written as AsciiDoc (html files anyways are too much work to maintain)
- closes #17
  • Loading branch information
lealceldeiro committed Feb 9, 2024
1 parent ab94114 commit 3ee69f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ Example `./mvnw jbake:inline`

## Creating an article

As a standard, we're writing all articles files as either [AsciiDoc](https://asciidoc.org/) (`.adoc`) or HTML (`.html`).
As a standard, we're writing all articles files as either [AsciiDoc](https://asciidoc.org/)(`.adoc`) or HTML(`.html`).
The preferred option is AsciiDoc as it provides more features,
including generating a table of content for the rendered html.

### File structure

Expand Down Expand Up @@ -125,6 +127,13 @@ Images used to be displayed in the book thumbnail (`image_src`) should be:
- _width_: 630px
- _height_: 850px

## Document customization

In both, articles and book notes is possible to create a table of content (toc) for those created as AsciiDoc files.
To do that, the [document attributes](https://docs.asciidoctor.org/asciidoc/latest/attributes/document-attributes/)
[`:toc:`](https://docs.asciidoctor.org/asciidoc/latest/toc/) and `:jbake-table_of_content:` (custom) must be set;
for now (and as standard) it can only be set to `left` (other values don't have any effect).

## Build and publish

When creating an article, if it's a work in progress, you can skip the pages build by appending `[skip-ci]` to the end
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/templates/post.thyme
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" lang="en">
<head th:replace="header.thyme::head(null, null)"></head>
<body>
<body th:class="${content.table_of_content} != null ? ('toc2 toc-left') : ''">
<div id="wrap" class="content-justify">
<div th:replace="menu.thyme::menu"></div>
<div class="container">
Expand Down

0 comments on commit 3ee69f6

Please sign in to comment.