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

:WIP: [Feature] Table of contents #226

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

pad92
Copy link
Contributor

@pad92 pad92 commented Nov 20, 2018

@pad92 pad92 changed the title adding toc [Feature] Table of contents Nov 20, 2018
@rootkea
Copy link

rootkea commented Nov 20, 2018

Hi! Is this complete?
I just checked out the toc branch and cloned in my 'themes' folder but I still can't see the table of contents beside any post.

BTW, I am testing exampleSite with hugo serve -D --themesDir ../..

Am I missing something?

Thanks!

@pad92
Copy link
Contributor Author

pad92 commented Nov 20, 2018

you need to enable it, by default it's disabled

{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }}

TODO :

  • update readme
  • update exemple config

@rootkea
Copy link

rootkea commented Nov 20, 2018

{{ if or .Params.toc (and .Site.Params.toc (ne .Params.toc false)) }}

Oops! My bad!

BTW, I think we should make ToC sticky to the side while page gets scrolled just like er theme.

@pad92
Copy link
Contributor Author

pad92 commented Nov 20, 2018

BTW, I think we should make ToC sticky to the side while page gets scrolled just like er theme.

Do you have js/css that ? :)

@rootkea
Copy link

rootkea commented Nov 21, 2018

umm.. We can look at the AllinOne[0] and/or Er[1] theme.

Sorry, I'm not good at css/js so can't really help :(

[0] https://themes.gohugo.io//theme/AllinOne/blog/2018-08/%E9%9F%B3%E4%B9%90%E5%89%A7catrepo/
[1] https://themes.gohugo.io//theme/er/post/migrate-from-jekyll/

@VincentTam
Copy link
Contributor

@pad92 Thanks again for your PR. Here's my another quick test result on my demo site at https://vincenttam.gitlab.io/bhdemo (source) built for testitng #222 and eduardoboucas/staticman#219.

Unluckily, your PR contains a bug, which can be easily fixed by applying the Go-HTML template in gohugoio/hugo#1778 (comment). Mind to fix that?

toc

@pad92
Copy link
Contributor Author

pad92 commented Nov 22, 2018

thx @VincentTam

@VincentTam
Copy link
Contributor

@pad92 In esponse to the original version of your previous comment, I've updated my demo site to include your commits, as well as #169

screenshot from 2018-11-22 12-56-09

@pad92
Copy link
Contributor Author

pad92 commented Nov 22, 2018

i have css with exempleSite ( from toc branch )

@VincentTam
Copy link
Contributor

@pad92 Thx for feedback. I have really no idea why your CSS code in static/css/main.css doesn't come up despite the merge commit 993979f of my fork of this theme on GitLab. Since I'm not proficient in HTML/CSS/JS at all (despite the submission of another PR supporting Staticman's nested comments), I regret to put this aside for the moment.

@pad92
Copy link
Contributor Author

pad92 commented Nov 23, 2018

i retry and have css
Do you clear your browser's cache ?

git clone --single-branch -b toc [email protected]:pad92/beautifulhugo.git
cd beautifulhugo/exampleSite/
hugo server --themesDir ../../

and open http://localhost:1313/post/2017-03-05-math-sample/

@VincentTam
Copy link
Contributor

I've tried that on another device.

20181123_165217_hdr

@VincentTam
Copy link
Contributor

It seems that in my site, your CSS is overidden by other rules, so I followed your instructions to test this PR. Your TOC seems a bit aligned to the right. The colors are consistent with the whole theme. I would like to leave a little remark that the border is a bit angled. In the homepage, the border for the front matter has border-bottom-left-radius: 4px (idem for right).

Example site screenshot

@pad92
Copy link
Contributor Author

pad92 commented Jan 16, 2019

if someone has an idea to fix ... I'm open :)

@pad92 pad92 mentioned this pull request Jan 20, 2019
@pad92
Copy link
Contributor Author

pad92 commented Mar 26, 2019

I've tried that on another device.

20181123_165217_hdr

i'm unable to reproduce this issue.

https://pad92.gitlab.io/demo_beautifulhugo/posts/my-second-post/
fork from your demo
( https://gitlab.com/pad92/demo_beautifulhugo )

If you have time to improve and update this request.

I want this feature for in the main project to delete my fork:)

@pad92
Copy link
Contributor Author

pad92 commented Apr 1, 2019

umm.. We can look at the AllinOne[0] and/or Er[1] theme.

Sorry, I'm not good at css/js so can't really help :(

[0] https://themes.gohugo.io//theme/AllinOne/blog/2018-08/%E9%9F%B3%E4%B9%90%E5%89%A7catrepo/
[1] https://themes.gohugo.io//theme/er/post/migrate-from-jekyll/

🎉 https://pad92.gitlab.io/demo_beautifulhugo/posts/my-second-post/ :)

I ended up listening to you, yes, it's easier that way.
I hope it doesn't generate too much overlap.

@pad92 pad92 changed the title [Feature] Table of contents :WIP: [Feature] Table of contents Apr 1, 2019
@pad92 pad92 changed the title :WIP: [Feature] Table of contents [Feature] Table of contents Apr 1, 2019
@rootkea
Copy link

rootkea commented Apr 2, 2019

Suggestions:

  1. Check out this AllinOne theme page. Observe how the control jumps from one item to another of the ToC as we scroll the page
  2. Clicking on a particular item of ToC, it smoothly scrolls (and not abruptly jumps) the page to that section.

@pad92 pad92 changed the title [Feature] Table of contents :WIP: [Feature] Table of contents Apr 2, 2019
* master:
  Add KaTeX fonts for use with self-hosted option
  Add option to self host static files
  Corrected Chinese Staticman UI string
  Added Japanese translation
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

Successfully merging this pull request may close these issues.

3 participants