Publii
Publii copied to clipboard
Tag Duplicates when tag slug doesn't match the tag Title exact
I noticed that a Tag will duplicate itself after a post is saved with that tag, but only if the Tag's slug is custom, and different than the title.
I tried to edit the Tag, but it auto-creates itself again.
The only workaround, for now, is to create a new Tag Template just for a custom title in the HBS markup.
Not sure why this bug occurs, but ideally, users would benefit from having Tag Title control that is different than the Tag URL.
Example: Title: "My Blog" URL (Slug): "blog"
Uncaught Exception: SqliteError: UNIQUE constraint failed: posts_tags.tag_id, posts_tags.post_id at Post.saveTag (/Applications/Publii.app/Contents/Resources/app.asar/back-end/post.js:495:18) at Post.saveTags (/Applications/Publii.app/Contents/Resources/app.asar/back-end/post.js:466:22) at Post.save (/Applications/Publii.app/Contents/Resources/app.asar/back-end/post.js:249:14) at IpcMainImpl.<anonymous> (/Applications/Publii.app/Contents/Resources/app.asar/back-end/events/post.js:20:31) at IpcMainImpl.emit (events.js:315:20) at IpcMainImpl.EventEmitter.emit (domain.js:483:12) at Object.<anonymous> (electron/js2c/browser_init.js:157:9051) at Object.emit (events.js:315:20) at Object.EventEmitter.emit (domain.js:483:12)
Mac OS 10.14.6 Publii Version 0.38.2 (0.38.2)
Hi,
Interesting case - I will try to fix it in v.0.38.3. If it's not some edge-case it would be strange that it hasn't been discovered earlier :)
Thanks, looking forward to this. We'll see if we can replicate the same bug on other Publii websites.
Temporarily we are using a custom tag template to wrap the tag with a custom title and retain the desired URL.
Hi @nordseo - I am unable to reproduce this issue :(
My flow:
- I have added two tags: Tag1 (slug: tag1) and Tag2 (slug: tag-second)
- I have added both of them to existing post - no duplication of Tag2 has been observed
- I have added Tag2 tag to newly created post - no duplication observed
I am missing something while I am trying to reproduce this issue?
I have checked the code and tag name is used for the save post-tag pairs purpose.
The only possible edge-case which I see - when you have some tag with slug which is the same as slugified name of other tag name e.g.
"Tag1" + slug = tag2 "Tag2" + slug = tag-second
Because the SQL query which looks for tags search for tag name and slug - in the above case Tag2 and Tag1 with slug tag2 will meet the conditions, but it should lead to random assignment of Tag1 instead of Tag2 not to creation of a new tag.
I'll close this for now. It seems to have randomly resolved itself, but still not sure why. The error log is all can provide for now. If this issue returns again, I will send you a copy of our site and re-open the issue.
Thanks @dziudek
@dziudek I have the same problem. I have two tags: Tag 2 - id 2 - meta OK - associate with my article Tag 1 - id 1 - meta OK - associate with my article
I associate the tags with an article and I get this: Tag 2 - id4 - meta empty - associate with my article Tag 1 - id3 - meta empty - associate with my article Tag 2 - id2 - META OK - associated with nothing Tag 1 - id1 - META OK - associated with nothing
If I do the same operation again, it doubles the number again!
In total I therefore created only two tags but I end up with more than 10 tags.
The problem is that the association with the articles is done with the last tags that were created automatically.
So now all my tag links to "id1" lead to an empty page ..
Hope this can help
Problem with windows AND mac
Thank you
@reachandy - sorry but I am still unable to reproduce this issue. I have tried to follow your flow but all is working correctly for me. Could you prepare some screen video so I could see this issue in action? I suppose that something is missing in my flow.
Hello @dziudek , you want to laugh ? I tried this morning and couldn't reproduce the problem... before I had it all the time and now I have no problem, oups. I'll get back to you if this issue comes up again. Thank you for the follow up