@huyingjie wrote:
@anthonyfok Thank you. Academic theme does not have table of contents sidebar https://themes.gohugo.io/theme/academic/post/getting-started/
The default Academic theme doesn’t, but its documentation does! And it turns out it is easy to copy the table of content sidebar to your Hugo website when using the Academic theme:
Initial preparation
- Run
git clone --recurse-submodules https://github.com/sourcethemes/academic-www.gitto get the Academic documentation website (this has the TOC sidebar in docs/) - Run
git clone --recurse-submodules https://github.com/sourcethemes/academic-kickstart.gitto get the Academic kickstart (plain vanilla but fully configured Academic theme). - Run
cd academic-kickstart, - Run
hugo new post test-post.md - Edit
content/post/test-post.mdin your favorite editor. - Run
hugo serverand navigate to the post that you just created. Note that there is no TOC sidebar.
Now, do the magic
Staying inside the academic-kickstart directory:
mkdir layoutscp -avi ../academic-www/layouts/docs layouts/post(for thesingle.htmltemplate)cp -avi ../academic-www/layouts/partials/ layouts/cp -avi ../academic-www/static/css/ static/which copiesstatic/css/custom.cssfor the TOC highlighting magic- Edit
config.toml, search forcustom_css = []and change it tocustom_css = ["custom.css"]
And that should do the trick!