Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table of contents to the integrations pages #13572

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ group :jekyll_plugins do
gem 'jekyll-sitemap', '1.4.0'
gem 'jekyll-time-to-read', '0.1.2'
gem 'jekyll-commonmark', '1.3.1'
gem 'jekyll-toc', '0.14.0'
end

gem 'sinatra', '2.1.0'
Expand Down
4 changes: 4 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ GEM
jekyll (>= 3.7, < 5.0)
jekyll-time-to-read (0.1.2)
jekyll
jekyll-toc (0.14.0)
jekyll (>= 3.8)
nokogiri (~> 1.10)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.3.0)
Expand Down Expand Up @@ -124,6 +127,7 @@ DEPENDENCIES
jekyll-paginate (= 1.1.0)
jekyll-sitemap (= 1.4.0)
jekyll-time-to-read (= 0.1.2)
jekyll-toc (= 0.14.0)
nokogiri (= 1.10.10)
rake (= 13.0.1)
sass-globbing (= 1.1.5)
Expand Down
19 changes: 19 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ highlighter: none

plugins:
- jekyll-time-to-read
- jekyll-toc

paginate: 10 # Posts per page on the blog index
paginate_path: "blog/posts/:num" # Directory base for pagination URLs eg. /posts/2/
Expand Down Expand Up @@ -123,16 +124,34 @@ defaults:
featured: false
# Defaults for blogs posts
- scope:
path: ""
type: posts
values:
layout: post
comments: true
footer: true
sharing: true
sidebar: true
# Enable table of contents for integrations
#
# To set toc as a default value, we need to set the scope with an empty path
# and the collection as type
# https://github.com/toshimaru/jekyll-toc/issues/116#issuecomment-644205770
#
- scope:
path: ""
type: integrations
values:
toc: true

# Support for files Jekyll will normally exclude
include:
- "_headers"
- "_redirects"
- ".well-known"

# Table of contents
# https://github.com/toshimaru/jekyll-toc
toc:
min_level: 2 # default: 1
max_level: 3 # default: 6
15 changes: 15 additions & 0 deletions sass/custom/_paulus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,21 @@ div.note {
.aside-module {
.section {
margin-bottom: 10px;

ul.section-nav {
margin-left: 0px;

li.toc-entry {
list-style-type: none;
li {
list-style-type: circle;
margin-left: 1em;
}
ul {
margin-left: 1em;
}
}
}
}

.brand-logo-container {
Expand Down
6 changes: 6 additions & 0 deletions source/_includes/asides/component_navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ <h1 class="title delta">Categories</h1>
</ul>
</div>
{%- endif -%}

{%- unless page.no_toc -%}
<div class='section'>
<h1 class="title delta">On this page</h1>
{% toc %}
{%- endunless -%}
</section>

<script src="https://alerts.home-assistant.io/ce-alert-link.js"></script>