Skip to content

Wrap gongan_icon_url with url_for#1520

Merged
jiangtj merged 1 commit into
theme-next:masterfrom
wtdcode:fix-gongan-icon-url
Jun 18, 2020
Merged

Wrap gongan_icon_url with url_for#1520
jiangtj merged 1 commit into
theme-next:masterfrom
wtdcode:fix-gongan-icon-url

Conversation

@wtdcode

@wtdcode wtdcode commented Jun 11, 2020

Copy link
Copy Markdown
Contributor

PR Checklist

  • The commit message follows guidelines for NexT.
  • Tests for the changes was maked (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs in NexT website have been added / updated (for features).

PR Type

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Build & CI related changes.
  • Documentation.
  • Translation.
  • Other... Please describe:

What is the current behavior?

The path to gongan_icon_url may be incorrect when it is set to a relative path like gongan.png in _config.yml.

For example, assume gongan_icon_url is gongan.png and current page url is localhost:4000/page/3/, the exact source of the generated img element is localhost:4000/page/3/gongan.png, rather than localhost:4000/gongan.png.

What is the new behavior?

It should be wrapped with url_for like this.

How to use?

In NexT _config.yml:

footer:
  beian:
    gongan_icon_url: beian.png

The path to `gongan_icon_url` may be incorrect when it is set to a relative path like `gongan.png` in _config.yml.

For example, assume `gongan_icon_url` is `gongan.png` and current page url is `localhost:4000/page/3/`, the exact source of the generated img element is `localhost:4000/page/3/gongan.png`, rather than `localhost:4000/gongan.png`.

It should be wrapped with `url_for` like [this](https://github.com/theme-next/hexo-theme-next/blob/a7a948a08f48dbe48879e277703d75706aec18e5/layout/_partials/sidebar/site-overview.swig#L4).
@welcome

welcome Bot commented Jun 11, 2020

Copy link
Copy Markdown

Thanks so much for opening your first PR here!

@jiangtj jiangtj added this to the 7.9.0 milestone Jun 15, 2020
@jiangtj jiangtj merged commit fdaf3e3 into theme-next:master Jun 18, 2020
@welcome

welcome Bot commented Jun 18, 2020

Copy link
Copy Markdown

Congrats on merging your first pull request here! 🎉 How awesome!

kyangc pushed a commit to kyangc/hexo-theme-next-1 that referenced this pull request Aug 31, 2020
…ew_head

* 'master' of github.com:theme-next/hexo-theme-next:
  fix: Chinese TOC cannot jump (theme-next#1540)
  Fix: Wrap `gongan_icon_url` with `url_for` (theme-next#1520)
CCCarrion pushed a commit to CCCarrion/hexo-theme-next that referenced this pull request Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants