Users are discussing how to share common content between pages in Discourse. John_Lehmann is looking for a solution to embed a snippet of content into multiple topics and be able to globally update it. Tom_Eagle suggests using a prefilled “staff notice” that can be automatically added to topics with a certain tag.
Johani recommends using a method where centrally maintained text markdown snippets can be inserted into topics. merefield provides links to relevant meta discussions on this topic.
After trying the suggested solution, Tom_Eagle encounters an issue with links not working and seeks help. Johani advises using HTML instead of markdown, as themes don’t have access to the cooking function that Discourse uses to render markdown.
I’m quite sure this is possible but don’t even know the right terms to search.
We want to embed a snippet of content into many different topics. Our particular use case is to put some comments about a certain type of topic, with links, etc. (Imagine, a “warning” or “alert” or “notification” – such as, “This article needs more references, click here to read more.”). We want to be able to globally update that content, not copy it around each time.
I think the best way to do this would be to automatically add a prefilled “staff notice” onto topics that have a certain tag. Is this a possibility already? Or a existing theme component/ plug in?
This is actually where my first thought was to look, and it might be the best option, but the best case scenario would be to have this information update on historic staff notices automatically.
Using CR we would need to go back through each topic and update the notices individually if any information changes.
Your example uses markdown. It would need to be cooked. Discourse cooks post on the server. Themes don’t have access to that.
Discourse has an async cook function that can run on the client-side; however, it requires the user to be logged in to resolve short URLs and load oneboxes and images. So, it won’t work for anonymous (not logged-in) users.