🐛 Fixed tag with # not generating "hash-" prefix at tag screen

closes https://github.com/TryGhost/Ghost/issues/11105

- Updates slug generation on tag screen to add "hash-" prefix for tags with name starting from #
This commit is contained in:
Rish 2019-09-23 19:58:11 +05:30
parent b62b8e4142
commit 1cc3b2ed7e

View File

@ -89,6 +89,9 @@ export default Controller.extend({
// Generate slug based on name for new tag when empty
if (propKey === 'name' && !tag.get('slug') && isNewTag) {
let slugValue = slugify(newValue);
if (/^#/.test(newValue)) {
slugValue = 'hash-' + slugValue;
}
tag.set('slug', slugValue);
}
// TODO: This is required until .validate/.save mark fields as validated