Hugo-theme-zzo: [Suggestion] Table of contents should be in the white space outside the content area

Created on 21 Jan 2020  路  16Comments  路  Source: zzossig/hugo-theme-zzo

Screenshot from 2020-01-21 01-15-41

The reasoning behind it is that when the table of contents is enabled it occupies a large portion of the content area.

Peek 2020-01-21 01-21

Most helpful comment

We have another param tocPosition

Your params.toml file,

...
tocPosition: outer # inner / outer
...

All 16 comments

I prefer a small content area.
I'll add an option to position it to the outside the content area

We have another param tocPosition

Your params.toml file,

...
tocPosition: outer # inner / outer
...

Question: When the TOC is outside the content section, in the "gutter" region as it is called, then when someone resizes the browser i.e the width is small enough then the TOC should not show at all.

Why?

Because it cannot fit in smaller screens. TOC should only show when the there is enough screen space for it to show in the "gutter" region.

Thoughts?

We already hide the toc when screen is small.
gg
Did you mean this content area is too small?

Yes, in the small screen the extra space is gone. I will need to re-check. If the TOC is hidden in smaller screen then everything is good 馃帀

Ok, so I ran this on my blog.

Found 2 problems
when using "inner"

inner

when using "outer"

outer

I imagined "outer" will have the toc all the time on side and people can enable disable it using the switch. Right now it is going in and out based on scrolling :thinking:

I fixed some issues.
The problem in the gif above, you need to set the Goldmark toc config

In your config.toml file,

...
[markup.tableOfContents]
    endLevel = 4
    ordered = false
    startLevel = 3
...

I found that in your post, the max title level is 3, and min title level is 4.

I know that every post doesn't have the same title level.
I tried to dynamically set the title level. But, I can't find an easy way to do this.
So I asked it to the Hugo community https://discourse.gohugo.io/t/can-i-get-the-goldmark-config-value/22947

-> The main problem is to folding the parent ul component. I'm thinking now that we might need to delete the folding feature

Interesting find. I did not know this. I will also investigate on my end. Thank you 馃槃

I see your test page and you kind of fixed the TOC section. When I resize the page, I see it is gone, but the switch with text still remains. I think it should be gone too.

Screen Shot 2020-01-22 at 10 16 45 AM

What do you think about this?

Ah, I didn't notice it. It should be gone!

Everything looks fixed by now. Thank you :+1:

I just noticed one small case. This is when there is no titles in the page, then "Whats on this page" should also go away.

Screenshot from 2020-01-23 19-26-51

when there is no titles in the page

Ah, yes you are right I'll check it

It's fixed now!
But I found another bug.
When we use the newly added tabs shortcode, toc not properly highlighted.
I'll investigate more about it.

I think you should open new issue for that and this issue should be closed.

Oh, I just uploaded the code.
All fixed now.

@nisrulz
And can you delete the content_font in the data/font.toml file.
I changed the contents fonts stack. Just in case the fonts stack fits your preference

Closing this issue then, since it is fixed!

Was this page helpful?
0 / 5 - 0 ratings