The discussion revolves around adding custom HTML to the Groups page in Discourse. Fausto_Dassenno wants to add a welcome/explanation HTML to the groups’ page, but only on the main group listing page.
Steven suggests using a plugin outlet, but later realizes it doesn’t work for the group main page. He provides an alternative solution using CSS to add a text banner, but it’s not ideal.
smrtey offers a better solution, which involves adding a div to the After Header section and using CSS to display it only on the groups page. This solution works for Fausto_Dassenno.
The discussion also touches on how to achieve the same result but only on the homepage. Canapin suggests checking the class used in the body element of the homepage and using that class to target the welcome message. Fausto_Dassenno shares a screenshot of his homepage, and Canapin advises him to use the developer tools to inspect the HTML code and find the correct classes.
In the end, Canapin suggests using .navigation-categories .welcome-message to target the welcome message on the homepage.
Hi all,
I am designing a community where every user needs to ask permission to enter a group and every group is controlling the access to a category.
I would like to add a welcome / explanation HTML to the groups’ page ( https://community.horbitercafe.com/g )
Yes, that does indeed allow HTML to be “injected” above the Group Name and other information on pages at, e.g., https://discourse.example.org/g/foo. Thanks for sharing.
@Fausto_Dassenno are you looking at something for the main group listing page, but not the individual group detail page?
<script type="text/x-handlebars" data-template-name="/connectors/before-group-container/plugin-outlet-component">
<div class="gr-horbiter">
your html code
</div>
</script>
Sorry I’m not sure I understand the question, english is not my first language, I can misunderstand a few things
You copy the script and html in the </head> section and add your welcome message, with some div or span if you want to customize it, and it should be good
Thanks @Steven I had it working.
Only issue is that I need this added in the group index page and not in the group detail page.
At least now I got the logic behind this. I’ll research more.
I cannot find any connector in the group index page.
I should have tested, I now see what’s the issue
The plugin outlet doesn’t work for the group main page
I still have a way to add a banner but it’s probably not the cleanest way possible, Discourse staff might have a better way to do it.
This css code will allow you to add some text and stylind, but you’ll only have this class and I don’t think there’s a way to add a link in the text banner
Thanks,
I cannot achieve my goal with this. What I was trying to do was to create a landing page for groups so that new users could have requested access to the groups they wanted. In order to do this I wanted to give some explanations with some html.
How hard is to request a new outlet name in the groups index page?
I see what’s the issue is for your empty body class.
Instead of looking at the page source, press F12 to show up the chrome/firefox/edge development tools and go to the “element” tab.
Look at the HTML code from here and your <body> will show the right classes.