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

How to enable by default for all pages #116

Closed
axilleas opened this issue Jun 2, 2020 · 4 comments
Closed

How to enable by default for all pages #116

axilleas opened this issue Jun 2, 2020 · 4 comments

Comments

@axilleas
Copy link

axilleas commented Jun 2, 2020

Hi! Thanks for the plugin! How is it possible to enable this by default for all pages? Here's a PR where I'm trying to enable this for some pages https://github.com/home-assistant/home-assistant.io/pull/13572/files.

In short:

  1. I'm using {% toc %} since this is applied in an aside.
  2. The pages I'm trying to enable this are defined as collections .
  3. toc: true is defined in the _config.yaml defaults .

Still, the ToC doesn't appear. If I set it explicitly in a page's frontmatter, it works, but I want to avoid that though since there are 1000+ pages this should be applied to.

Any help would be appreciated, thanks!

@Potherca
Copy link

I'm just a casual user, but I had the same sort of issue. Setting toc in the defaults with an empty path and the collection as type worked for me:

defaults:
  -
    scope:
      path: ""
      type: "integrations"
    values:
      toc: true

If this doesn't help, it might be worth setting up a separate repo with a minimal use-case, to make sure it isn't something outside this plugin that is messing with things.

Looking at the code you linked to, you seem to be missing the required path for the type: posts entry.

While type is optional, you must specify a value for path when creating a scope/values pair.

source: https://jekyllrb.com/docs/configuration/front-matter-defaults/

Not sure if that is mesing anything up but it might be worth fixing.

@axilleas
Copy link
Author

@Potherca this worked! Thanks a lot for this ❤️

@frenck
Copy link

frenck commented Jul 14, 2020

Hey @Potherca :)

Thanks for helping out 😉

toshimaru added a commit that referenced this issue Oct 25, 2020
toshimaru added a commit that referenced this issue Oct 25, 2020
* Remove features from test_files

* Modify description

* {% toc %} tag / toc_only filter

* Move "Default Configuration" to the customization section

* Add  _config.yml

* Refine English

* Add " Alternative Tools"

* Update TOC

* Update README.md

* Update TOC again

* Add "Enable TOC by default"

closes #116
@toshimaru
Copy link
Owner

I've added Enable TOC by default section to README. 👍

https://github.com/toshimaru/jekyll-toc#enable-toc-by-default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants