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.
No this can not be done, slug is coupled to title.
@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.
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.
这种情况是否仍然存在?
我的用例是:Ghost博客上的帖子会在Discourse中创建主题。我遵循了Ghost创始人上述的建议,缩短了帖子的 slug 长度,并在我最近的帖子中进行了操作。Discourse 从帖子的标题(而不是 slug)创建 slug。虽然这一切都运行正常,但我还有一个 discourse-get-comment-count 脚本在首页(以及每篇独立帖子的顶部)显示帖子的评论数。问题是,它正在查询Discourse(如果我的术语正确的话)帖子的 slug,而不是标题,因此它找不到实际的评论数。(您可以看到网站顶部的帖子的评论数卡在加载图标上。)
除了不自定义 slug 之外,我还能做些什么吗?
这个实现让我 ![]()
为什么它在这里不使用 topic_id:discourse-get-comment-count/update-comments.js at master · vikaspotluri123/discourse-get-comment-count · GitHub
如果它那样做了,那么 slug 就完全无关紧要了。
我不会假装完全理解这一点,但当我转述您的建议时,我得到的回复是这样的:
我们如何根据 Ghost 帖子的 ID、slug 或 URL 获取 topic_id?
我的理解是,我们可以使用帖子 ID 通过
external_id属性链接主题,但似乎 external_id 的使用仅限于 API,并且主题是使用嵌入功能创建的(该功能似乎不支持 external_id)。
顺便说一句,与我之前评论中所说的相反,我在几个小时前已将上述 Ghost 帖子的 slug 改回了默认值,这意味着评论计数不会卡在加载图标上。
如果您依赖我们的嵌入,那么 Discourse 会维护一个嵌入 URL 和主题之间的映射。
因此,您可以使用:
来获取评论计数列表。
获取评论计数可以简单地使用 ghost URL 调用该端点。我们愿意考虑创建一个“批量”端点,以便您可以传递多个 URL。关于此,欢迎提交 PR(pr-welcome)。