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

list_tags helper is not working as expected #4058

Open
noraj opened this issue Jan 5, 2020 · 0 comments · May be fixed by #4059
Open

list_tags helper is not working as expected #4058

noraj opened this issue Jan 5, 2020 · 0 comments · May be fixed by #4059

Comments

@noraj
Copy link

@noraj noraj commented Jan 5, 2020

Check List

Please check followings before submitting a new issue.

  • I have already read Docs page & Troubleshooting page
  • I have already searched existing issues and they are not help to me
  • I examined error or warning messages and it's difficult to solve
  • Using the latest version of Hexo (run hexo version to check)
  • Node.js is higher than 8.6.0

Expected behavior

Actual behavior

list_tags helper is not working as expected https://hexo.io/docs/helpers#list-tags

When I'm using:

list_tags(site.tags, {show_count: false, class: 'classtest', style: false, separator: '', suffix: 'toto'})

I get

<a class="classtest-link" href="/tags/post/toto" rel="tag">post</a>
<a class="classtest-link" href="/tags/tag/toto" rel="tag">tag</a>

The class is classtest-link instead of classtest whatever I do -link is always happened.

It must be the same behavior for other list_* helpers.

https://github.com/hexojs/hexo/blob/master/lib/plugins/helper/list_tags.js

By reading the source code it seems they are hardcoded.

image

This make sens for the list style but when not using the list style this prevent from controlling the class name. So for example the CSS I use (bulma) need the tag class to be tag to display correctly, but since -link is appended this make it wrong.

The workaround currently is to use a useless class as the last class to null the -link append class: 'tag is-primary uselessclass'

image

How to reproduce?

let me know if your need more information

Environment & Settings

Node.js & npm version

Your site _config.yml (Optional)

Your theme _config.yml (Optional)

Hexo and Plugin version(npm ls --depth 0)

$ hexo version
hexo: 4.2.0
hexo-cli: 3.1.0
os: Linux 5.4.7-arch1-1 linux x64
http_parser: 2.8.0
node: 10.15.3
v8: 6.8.275.32-node.51
uv: 1.23.2
zlib: 1.2.11
ares: 1.15.0
modules: 64
nghttp2: 1.34.0
napi: 3
openssl: 1.1.0j
icu: 62.1
unicode: 11.0
cldr: 33.1
tz: 2018e

Your package.json package.json

Others

@noraj noraj changed the title list_tags helper is not workign as expected list_tags helper is not working as expected Jan 5, 2020
noraj added a commit to noraj/hexo that referenced this issue Jan 5, 2020
When the style `list` is not used, don't append `-link` to the class name, it prevents to fully control class name and so css framework to work correctly.

fix hexojs#4058
@noraj noraj mentioned this issue Jan 5, 2020
0 of 3 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.