CaiJimmy / hugo-theme-stack

Card-style Hugo theme designed for bloggers
https://stack.jimmycai.com
GNU General Public License v3.0
4.83k stars 1.55k forks source link

Bug: back button UI #250

Closed zjjxwhh closed 3 years ago

zjjxwhh commented 3 years ago

Describe the bug

关于文章左上角的返回按钮

  1. 部分文章左上角不显示返回按钮
  2. 修改 DefaultContentLanguage 参数后,本地渲染按钮文字为中文,上传github渲染之后为英文,且按钮大小不一致

Expected behavior

  1. 所有文章左上角均显示返回按钮
  2. 按钮文字跟随 DefaultContentLanguage 参数,按钮大小一致

To Reproduce

  1. 创建 Test 页面

正文开头为H1时不显示返回按钮:

---
author: Hugo Authors
title: Test
date: 2021-06-26T20:41:08+08:00
description: This is just a test
---

# TEST

## test

its just a test.

111

正文开头为H2时显示返回按钮:

---
author: Hugo Authors
title: Test
date: 2021-06-26T20:41:08+08:00
description: This is just a test
---

## TEST

## test

its just a test.

111
  1. 设置 DefaultContentLanguage 参数

Screenshots

  1. 部分返回按钮不显示:

1

2

  1. 返回按钮渲染不一致

3

Environment

Additional context

Add any other context about the problem here.

If it's a UI issue, fill the following information:

刚开始用hugo,看了你的中文文档,尝试了一下发现这些问题,如果是我自己的问题也请一定告诉我,非常感谢!

Content of config.yaml

baseurl: https://blog.hervey.top/
languageCode: en-us
theme: hugo-theme-stack
paginate: 5
title: Hervey's Blog
uglyurls: true

# Change it to your Disqus shortname before using
disqusShortname: hugo-theme-stack

# GA Tracking ID
googleAnalytics:

# Theme i18n support
# Available values: en, fr, id, ja, ko, pt-br, zh-cn, es, de, nl
DefaultContentLanguage: zh-cn

permalinks:
    post: /p/:slug/
    page: /:slug/

params:
    mainSections:
        - post
    featuredImageField: image
    rssFullContent: true
    favicon:

    footer:
        since: 2021
        customText: CREATED AND RECORDED WITH LOVE

    dateFormat:
        published: Jan 02, 2006
        lastUpdated: Jan 02, 2006 15:04 MST

    sidebar:
        emoji: 🎮
        subtitle: Hervey's personal blog. Recording life, sharing insights.
        avatar:
            local: true
            src: img/RingCatSquare.gif

    article:
        math: false
        toc: true
        license:
            enabled: true
            default: Licensed under CC BY-NC-SA 4.0

    comments:
        enabled: false
        provider: disqus

        utterances:
            repo:
            issueTerm: pathname
            label:

        remark42:
            host:
            site:
            locale:

        vssue:
            platform:
            owner:
            repo:
            clientId:
            clientSecret:

        # Waline client configuration see: https://waline.js.org/en/reference/client.html
        waline:
            serverURL:
            lang:
            visitor:
            avatar:
            emoji:
                - https://cdn.jsdelivr.net/gh/walinejs/emojis/weibo
            requiredMeta:
                - name
                - email
                - url
            placeholder:
            locale:
                admin: Admin

    widgets:
        enabled:
            - search
            - archives
            - tag-cloud

        archives:
            limit: 5

        tagCloud:
            limit: 10

    opengraph:
        twitter:
            # Your Twitter username
            site:

            # Available values: summary, summary_large_image
            card: summary_large_image

    defaultImage:
        opengraph:
            enabled: false
            local: false
            src:

    colorScheme:
        # Display toggle
        toggle: true

        # Available values: auto, light, dark
        default: auto

    imageProcessing:
        cover:
            enabled: true
        content:
            enabled: true

### Custom menu
### See https://docs.stack.jimmycai.com/configuration/custom-menu
### To remove about, archive and search page menu item, remove `menu` field from their FrontMatter
menu:
    main:
        - identifier: home
          name: Home
          url: /
          weight: -100
          pre: home

related:
    includeNewer: true
    threshold: 60
    toLower: false
    indices:
        - name: tags
          weight: 100

        - name: categories
          weight: 200

markup:
    tableOfContents:
        endLevel: 4
        ordered: true
        startLevel: 2
    highlight:
        noClasses: false

Link to the demo site and/or source repository:

https://blog.hervey.top/p/test.html

https://github.com/zjjxwhh/Hugo-Blog

zjjxwhh commented 3 years ago

问题同样可见于提供的example site:

https://theme-stack.jimmycai.com/p/emoji-support/

CaiJimmy commented 3 years ago

部分文章左上角不显示返回按钮

没有 TOC 的文章不会显示。

正文开头为H1时不显示返回按钮:

修改 config.yaml,把 markup.tableOfContents.startLevel 改成 1

markup:
    tableOfContents:
        endLevel: 4
        ordered: true
        startLevel: 1

修改 DefaultContentLanguage 参数后,本地渲染按钮文字为中文,上传github渲染之后为英文,且按钮大小不一致

语言的问题应该和主题没关系,可能是上传出了问题。

按钮大小问题已经在 master 分支解决了 (#245),但是还没发新版本,也就没有编译出最新的 CSS。

改成用 Hugo Extended 版本即可。

zjjxwhh commented 3 years ago

全部解决了,果然全都是我配置的问题:sweat_smile: 真的非常感谢帮助