how to add content (html) below posts?
In the image, the placement is right below the like bar and link of each post
The discussion revolves around adding custom HTML content below posts in a Discourse forum. hoangviet seeks help in placing content below the “like bar and link” of each post, and shares an image to illustrate the desired position.
hoangviet found a tutorial on the topic, but is concerned about ad blockers hiding the content. They later shared the code they are using and asked for help in customizing it to position the content below the “post author and date” row, providing another image to show the desired location.
hoangviet shared the code they are currently using, which utilizes the post: after widget to add the custom HTML content. However, pfaffman advised against using widgets, pointing to a discussion on the widget API and its roadmap as a resource for alternative approaches.
Out of curiosity, could you send the link to this topic?
I found a tutorial topic for this here.
But I’m worried that ad blockers will hide the content (html) below these posts.
this is the code i use, but if i want to change the position of the content (html) to the position right below the row : post author and date. Can anyone help me customize the position in this code ?
In the image, I am circling the location where I want to place the content using code.
<script type="text/discourse-plugin" version="0.8">
const RawHtml = require("discourse/widgets/raw-html").default;
api.decorateWidget("post:after", helper => {
return [
new RawHtml({
html: `<div id="custom-ad">
<h3>Another simple box</h3>
<p>
Integer velit ante,
<a href="https://meta.discourse.org/">DISCOURSE</a>
amet tristique in, gravida at ligula. Sed gravida mauris id
neque vestibulum semper. Suspendisse potenti. Nam
nec maximus ligula. Ut eget semper est. Sed ornare
sit amet justo eu rutrum. Integer sit amet facilisis ipsum.
</p>
</div>`
})
];
});
</script>
You don’t want to use widgets. See Widgets, the Widget API and their roadmap?