Skip to content

Blog post do not have a table of contents with toc.integrate enabled. #4724

Closed
@tylernguyen

Description

@tylernguyen

Contribution guidelines

  • I've read the contribution guidelines and wholeheartedly agree

I've found a bug and checked that ...

  • ... the problem doesn't occur with the mkdocs or readthedocs themes
    ... the problem persists when all overrides are removed, i.e. custom_dir, extra_javascript and extra_css
    ... the documentation does not mention anything about my problem
    ... there are no open or closed issues that are related to my problem

Description

With toc.integrate enabled, blog posts do not have a table of contents.

Expected behaviour

Preferably, the table of the contents should appear on the left side of the blog post, above author information and metadata.

Actual behaviour

Blog posts lack a TOC, appearing neither left or right.

Steps to reproduce

Enable toc.integrate within mkdocs.yml

Package versions

  • Python: 3.11
  • MkDocs: Insiders commit 78de2df
  • Material: 1.4.2

Configuration

features:
   - toc.integrate

System information

  • Operating system: Windows 11
  • Browser: Firefox

Activity

squidfunk

squidfunk commented on Dec 10, 2022

@squidfunk
Owner

Thank for reporting. Yes, that's not currently not supported, because there's no place where the table of contents can live in the navigation. I'm not sure how it should behave. We could exempt the integration logic for blog posts, but that would kind of be inconsistent.

tylernguyen

tylernguyen commented on Dec 10, 2022

@tylernguyen
SponsorAuthor

Preferably, I would want for the TOC to live above author and metadata info on the left. There is too much white space on the left. Something of this order:

  • TOC
  • Author
  • Metadata
  • Related Links

Hopefully, this isn't too hard to integrate. But if it is, I guess the ability to example integration logic for blog posts can be a temporary fix until a better solution is thought of.

squidfunk

squidfunk commented on Dec 10, 2022

@squidfunk
Owner

Hmm, it would visually likely deviate from the current integration in the navigation, as there's no top-level navigation item to position it under. I'll evaluate this, but I can't give a guarantee that this will be implemented eventually.

added
needs investigationIssue must be investigated by the maintainers
and removed
needs inputIssue needs further input by the reporter
on Dec 11, 2022
squidfunk

squidfunk commented on Dec 12, 2022

@squidfunk
Owner

So turns out – it's not trivial. Adding it to the left sidebar, which is a third sidebar will induce several problems. Thus, I've disabled toc.integrate for blog posts, for now in 1f0c8baec. This may change in the future. The blog post templates are definitely going to be revamped at some point, the current version being the first iteration. Your feedback is very valuable and it will be considered when I work on the blog templates again.

added
bugIssue reports a bug
resolvedIssue is resolved, yet unreleased if open
and removed
needs investigationIssue must be investigated by the maintainers
on Dec 12, 2022
tylernguyen

tylernguyen commented on Dec 13, 2022

@tylernguyen
SponsorAuthor

The latest commit seems to disable toc.integrate universally. Can you please double check so that it only disables toc.integrate for blog posts? As I still very much love the layout, styling, and spacing that toc.integrate gives me.

squidfunk

squidfunk commented on Dec 14, 2022

@squidfunk
Owner

Oh, thanks for noting. I'll take a look.

removed
resolvedIssue is resolved, yet unreleased if open
on Dec 14, 2022
squidfunk

squidfunk commented on Dec 14, 2022

@squidfunk
Owner

I've reverted the changes in ee12d9f95, as this needs some more thought. I assumed that MkDocs would create fresh copies of the configuration to pass to the templates, and this configuration is immutable, but it isn't. This also means that you can probably change values from the templates themselves. I may have a better idea how to solve this problem.

squidfunk

squidfunk commented on Jan 8, 2023

@squidfunk
Owner

Fixed in f5b77bf23. The table of contents is now moved to the left when toc.integrate is enabled. I'll revisit the blog layout and sidebar later this year, trying to improve the current situation. However, this can be considered fixed for now:

Bildschirmfoto 2023-01-08 um 11 32 27

added
resolvedIssue is resolved, yet unreleased if open
on Jan 8, 2023
squidfunk

squidfunk commented on Jan 8, 2023

@squidfunk
Owner

Released as part of 9.0.3+insiders-4.27.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue reports a bugresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @squidfunk@tylernguyen

        Issue actions

          Blog post do not have a table of contents with toc.integrate enabled. · Issue #4724 · squidfunk/mkdocs-material