reuixiy / hugo-theme-meme

😝 You can’t spell awesome without MemE!
https://io-oi.me/hugo-theme-meme
MIT License
1.01k stars 279 forks source link

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

Open liuliancao opened 2 years ago

Borber commented 2 years ago

+1

soreatu commented 2 years ago

+10086

reonokiy commented 2 years ago

64 read this

huoranger commented 2 years ago

附议

koktlzz commented 2 years ago

目录的样式在 _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 commented 2 years ago

目录的样式在 _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 commented 2 years ago

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

koktlzz commented 2 years ago

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

huoranger commented 2 years ago

按这个思路自己改了一下 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 commented 2 years ago

为什么我按照你的来写不生效呢?我按照你的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 commented 2 years ago

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

example