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

{{slug}} attribute in navigation.hbs skips most if not all non-ascii characters #10258

Closed
TJYSunset opened this issue Dec 10, 2018 · 1 comment · Fixed by #10267
Closed

{{slug}} attribute in navigation.hbs skips most if not all non-ascii characters #10258

TJYSunset opened this issue Dec 10, 2018 · 1 comment · Fixed by #10267
Labels
good first issue [triage] Start here if you've never contributed before. help wanted [triage] Ideal issues for contributors to help with server / core Issues relating to the server or core of Ghost

Comments

@TJYSunset
Copy link
Contributor

Issue Summary

{{slug}} attribute in navigation.hbs ignores non-ascii characters such as À (Latin-1 Supplement), А (Cyrillic) and (CJK Unified Idegraphs).

To Reproduce

  1. Add an entry with the label "ÀА文" in Settings > Design > Navigation.
  2. Set theme to Casper so the {{slug}} attribute will be added to the html tag's class.
  3. Inspect source in your browser - the html tag should look like
<li class="nav-" role="menuitem"><a href="url">ÀА文</a></li>

Why do you consider this to be a bug?

This emits an empty string for every label consisting only non-ASCII characters, making the {{slug}} attribute virtually useless or unexpectedly-behaving on non-English sites.

What did you expect to happen instead?

Consider romanizing slugs like the automatic post url generation did.

And, consider making slugs customizable via Settings > Design > Navigation.

And, consider providing a {{slug-base64}} or something similar that yields base64 encoded utf-8 data, to handle non-romanizable characters (emojis?) and characters with multiple romanizations ( in Mandarin Chinese can be romanized as either le or yue) better.

Technical details:

  • Ghost Version: 2.7.1
@kirrg001
Copy link
Contributor

Hey 👋 Thanks for your report.

Can confirm the bug report. The slugify function probably can just use our safe string utility.

PR is welcome 👍

@kirrg001 kirrg001 added themes server / core Issues relating to the server or core of Ghost help wanted [triage] Ideal issues for contributors to help with good first issue [triage] Start here if you've never contributed before. labels Dec 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue [triage] Start here if you've never contributed before. help wanted [triage] Ideal issues for contributors to help with server / core Issues relating to the server or core of Ghost
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants