Can we change the title of the topic without changing the slug?

Can we change the title of the topic without changing the slug, at least for admin?

The old slug URL would still redirect to the article, is that your concern with the slug changing?

No, I know that it will redirect, but I prefer not having redirection and just change the title, like in wordpress.

That probably needs to be logged in the feature category then as I’m pretty sure that it isn’t something Discourse currently allows.

2 Likes

No this can not be done, slug is coupled to title.

4 Likes

@sam does the old url then redirect to the new one? Concerned that if we allow high trust users to edit topics, we may end up sending visitors from old links to broken pages.

Is the slug appears in the database? If so, there should be no problem allowing the admin at least to change the title. If the slug isn’t in the database, it is a problem.

The old URL does redirect, it’s ID based and it checks if the slug is the same as the one in the databse or after normalization of the title. I blieve.

1 Like

The slug is cached, but but the source of truth is always the topic title. Quite a few internals need to be changed to allow overriding, not on any roadmap.

5 Likes

Is this still the case?

My use-case is: Posts on my Ghost blog create topics on Discourse. I’ve followed an aforementioned suggestion by Ghost’s founder to truncate the length of the slug, which I did with my most recent post. Discourse creates the slug from the title of the post, not the slug of the post. While that all works fine, I’ve also got a discourse-get-comment-count script in use which displays on the home page (as well as at the top of each individual post) how many comments each post has. Problem is, it’s querying Discourse (if I have the lingo correctly) for the post’s slug, not its title, and so it doesn’t discover the actual comment count. (You can see the post at the top of the site has the comment count stuck on the spinner.)

Is there anything I can do about that besides not customising the slug?

This implementation is making me :thinking:

Why is it not using topic_id here: discourse-get-comment-count/update-comments.js at master · vikaspotluri123/discourse-get-comment-count · GitHub

If it did that the slug would not matter at all.

I won’t pretend to completely understand this, but this is what I was told in return when relaying your suggestion:

How would we get the topic_id based on a Ghost post id, slug, or url?

My understanding is that we could use the post id to link the topic via the external_id property, but it seems that the external_id usage is limited to the api, and topics are created using the embed feature, (which doesn’t seem to support external_id).

As a side note, contrary to what I stated in my previous comment I amended the slug back to its default in the aforementioned Ghost post a couple of hours ago, meaning the comment count isn’t stuck on the spinner as stated.

If you are leaning on our embedding then Discourse maintains a map between embed URL and topic.

So you could use:

To get the list of comment count.

Get comment count could just call that endpoint with the ghost url. Open to possibly making a “batch” endpoint so you can pass it multiple urls. pr-welcome on that.

1 Like