How to have common content shared between pages?

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.

Please point me in the right direction, thanks.

2 Likes

Hi guys, I’m with John here.

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?

Is there something in the Canned Replies plugin you could use?

1 Like

I appreciate your help!

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.

There was also this:

and this suggestion:

3 Likes

Hey @merefield

Thank you for your help here. We decided to go with @Johani method that you linked and it works in almost the perfect fashion, bar one thing.

For some reason it doesn’t work for links -

Would you happen to know a way to fix this?

1 Like

Short answer… use HTML, not markdown.

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.

3 Likes

@Johani you are an absolute star my friend :ok_hand:

2 Likes