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

toc可放左边或者右边吗 而不是顶部 #368

Open
liuliancao opened this issue Jan 22, 2022 · 11 comments
Open

toc可放左边或者右边吗 而不是顶部 #368

liuliancao opened this issue Jan 22, 2022 · 11 comments

Comments

@liuliancao
Copy link

No description provided.

@Borber
Copy link

Borber commented Feb 4, 2022

+1

@soreatu
Copy link

soreatu commented Apr 8, 2022

+10086

@reonokiy
Copy link

reonokiy commented May 27, 2022

#64 read this

@huoranger
Copy link

附议

@koktlzz
Copy link

koktlzz commented Aug 11, 2022

目录的样式在 _single.scss 中的.content,如果要固定在页面边缘,可以设为position: fixed

页面的配置则在 post.html,目录默认和博文放在同一个容器内,因此还需要把它从里面拿出来:

<main class="main single" id="main">
    
    // 目录
    {{ $enableTOC := .Params.toc | default .Site.Params.enableTOC -}}
    {{- if $enableTOC -}}
    {{- partial "utils/toc.html" . -}}
    {{- end -}}

    <div class="main-inner"> ...
    </div>

我的博客目前是这样:

202208111542

@Borber
Copy link

Borber commented Aug 11, 2022

目录的样式在 _single.scss 中的.content,如果要固定在页面边缘,可以设为position: fixed

页面的配置则在 post.html,目录默认和博文放在同一个容器内,因此还需要把它从里面拿出来:

<main class="main single" id="main">
    
    // 目录
    {{ $enableTOC := .Params.toc | default .Site.Params.enableTOC -}}
    {{- if $enableTOC -}}
    {{- partial "utils/toc.html" . -}}
    {{- end -}}

    <div class="main-inner"> ...
    </div>

我的博客目前是这样:

202208111542

来个PR, 拜托了! 🤞

@reonokiy
Copy link

按这个思路自己改了一下
https://github.com/sperjar/hugo-theme-meme/tree/dev
image

@koktlzz
Copy link

koktlzz commented Aug 12, 2022

@Borber 作者在 #64 里说不会合并类似的代码,不过我还是提了😂 #398

@huoranger
Copy link

按这个思路自己改了一下 https://github.com/sperjar/hugo-theme-meme/tree/dev image

为什么我按照你的来写不生效呢?我按照你的commit修改了layouts/partials/pages/post.html,asserts/scss/layout/_single.scss,asserts/scss/base/_data-attributes.scss,assert/scss/main.scss,以及config.toml文件,请问还需要修改哪里吗?

@huoranger
Copy link

为什么我按照你的来写不生效呢?我按照你的commit修改了layouts/partials/pages/post.html,asserts/scss/layout/_single.scss,asserts/scss/base/_data-attributes.scss,assert/scss/main.scss,以及config.toml文件,请问还需要修改哪里吗?

鼠标悬浮才会显示TOC

我把你的dev分支clone到我的主题文件夹下,然后修改了站点配置文件config.toml,仍然不行,是否还需要修改其他地方呀

@reonokiy
Copy link

我把你的dev分支clone到我的主题文件夹下,然后修改了站点配置文件config.toml,仍然不行,是否还需要修改其他地方呀

example

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

No branches or pull requests

6 participants