Find by Slug or Create
-
I'm integrating NodeBB with another system and need a URL which will:
- Find a topic using only a slug, without the topic id.
- If the topic is found, show the topic page.
- If no topic is found, show the user the New Topic page and associate it with a category.
For example, I hit the URL:
/topic/this-is-a-topic?category=the-category
The browser then redirects to either
/topic/99/this-is-a-topic
or to a New Topic page for the given category:
/categories/88/the-category/new-topic
Is there any built-in way to do this? Or are there any plug-ins which will do this?
-
If there were multiple topics with the same slug I would show the user a list of those topics with a summary text of the body content and allow them to click on the one they want to read.
Anyone know of some sample code to find a list of topics based on the slug?
Copyright © 2024 NodeBB | Contributors