-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
TOC for blog posts #1520
Comments
@derekmichaelwright you can actually create a side toc like this: https://charlieleee.github.io/post/matlab-phase-plane/ |
how do you actually configure it? Thanks in advance! |
Change the file {{- define "main" -}}
{{ if .Params.toc }}
<div class="container-fluid docs">
<div class="row flex-xl-nowrap">
<div class="d-none d-xl-block col-xl-2 docs-toc">
<ul class="nav toc-top">
<li><a href="#" id="back_to_top" class="docs-toc-title">{{ i18n "on_this_page" }}</a></li>
</ul>
{{ .TableOfContents }}
{{ partial "docs_toc_foot" . }}
</div>
<main class="col-12 col-md-0 col-xl-10 py-md-3 pl-md-5 docs-content" role="main">
{{ end }}
<article class="article">
{{ partial "page_header" . }}
<div class="article-container">
<div class="article-style">
{{ .Content }}
</div>
{{ partial "page_footer" . }}
</div>
</article>
{{ if .Params.toc }}
</main>
</div>
</div>
{{ end }}
{{- end -}} and add the following line to the front matter of the posts you'd like to add side toc: |
@CharlieLeee Thanks sir, i almost got it. I modified the single.html and set toc: TRUE in YALM. Also created different #Titles, but nothing appears but "Contents". Do you know what's going on? If I set toc here the fixed toc appears but not the side one
Many thanks, i searched about it but nothing done fixed it. |
@CarlosVecina From your screenshot, it seems like we're using a different version of the academic theme, so I guess it might have something to do with the table of content settings: can you find the following lines in your [markup.tableOfContents]
startLevel = 2
endLevel = 4 |
I tried this and have the same problem as @CarlosVecina. I do not have those lines in my /config/_default/params.toml file (dont have config.toml, instead have params.toml, menus.toml and languages.toml) |
@derekmichaelwright it's on the academic version. Btw, I think is something with de Rmd and the .TableOfContents. Can you @CharlieLeee confirm you are using rmd? It's weird cause the centered toc works fine for me. |
@CarlosVecina Please make sure that you modify the single.html file in your root directory (not the themes directory) layouts As for markdown, I use .md files. And my files looks like this: index.md
|
@CharlieLeee it works perfectly, Thank you!! |
UPDATE: it works for the posts created with python, but not for the ones created in R... |
@CharlieLeee It works on .md format, not Rmd file. |
Please let me know if I should create a new issue, but I think my issue is closely related to this one. I changed all my blog posts to
It would be cool if we could use |
@data-coder feel free to open a feature request issue for the community to weigh in and feedback on possibility of making docs pages appear similarly to blog posts. |
…-blox-builder#1520 to allow for a floating TOC.
@CharlieLeee it worked perfectly! Thanks! |
- `config.yaml`" change TOC depth - `assets/scss/custom.css` additions: rbind/apreshill@0609844#diff-9d884e0f3405793b5b5cdbd160e258d09b73d166be0532963e9987c73fe29d6f - `layouts/_default/single.html`: rbind/apreshill@0609844#diff-b2ff2a8d1f2a8a15c65288757c8b9acde7bec0ef491acb8048f1ddb61985cc41 - other `layouts/_default/.*single.html`: other versions: HugoBlox/hugo-blox-builder#1520 (comment)
Shouldn't this issue be opened considering that this is not yet implemented without changing the html files? |
Have you worked out this problem with .Rmd? This method only works for .md, not for .Rmd. It is really troubling since sometimes I need to show the R command. |
@nick-zhy Yes, I believe the current solution only works with |
Thanks for your method. As for .rmd, I need to convert .rmd to .md and then change the formulas one by one.... |
In order to make the |
Thanks. Following @chenx2018 method is helping to create TOC. Anyway, in my project theme, TOC only shows from secondary heading onwards but it looks good. |
When i click the TOC, the page directly jump to the content, Is there any way to make the rolling smoothly? |
Feature Request
some of my blog posts are very long. Is it possible to get a TOC for blog posts?
It would be nice to have something like a floating TOC that can be done when rendering as html, or like with the "courses" page
The text was updated successfully, but these errors were encountered: