I have made a custom homepage by:
a) adding the class .custom-homepage to the landing page. I use this to simply target the content I want to hide/adjust on that specific page via my custom css.
b) add any new components straight in the head file of my default theme custom html.
This is what it looks like:
<script type="text/discourse-plugin" version="0.8">
api.registerConnectorClass("above-main-container", "custom-homepage", {
setupComponent(args, component) {
var topMenuRoutes =
component.siteSettings.top_menu.split('|')
.map(function(route) {return '/' + route});
// The first page listed in the 'top_menu' setting is your homepage
var homeRoute = topMenuRoutes[0];
// This calls our code whenever the page changes
api.onPageChange((url) => {
// Check if we're on the homepage
if (url === "/" || url === homeRoute ){
// If it's the homepage add the 'custom-homepage' class to HTML tag
// and set 'displayCustomHomepage' to true
document.querySelector("html").classList.add("custom-homepage");
component.set("displayCustomHomepage", true);
} else {
// If we're not on the homepage remove the class
// and set `displayCustomHomepage` to false
document.querySelector("html").classList.remove("custom-homepage");
component.set("displayCustomHomepage", false);
}
});
}
});
</script>
<script type="text/x-handlebars" data-template-name="/connectors/above-main-container/custom-homepage">
{{#if displayCustomHomepage}}
<div class="custom-homepage-wrapper mask-polygon">
<div class="custom-welcome-banner">
<h1 class="welcome-header-text">VÀlkommen till Sveriges idéburna byggrörelse</h1>
<p>HÀr kan du se fÀrdiga och planerade projekt, hitta kunskap, fÄ rÄd - och fÄ kontakt med andra som bygger och bor ihop över hela landet.</p>
</div>
</div>
{{whos-online}}
{{search-menu}}
<div class="two-column-layout">
<div>
(My own code for the map image is here, I'll spare you)
</div>
<WANTED DIV>
(This is where I want to put my feed, perhaps something like {{categories-topic- list topics=latest filter=âlatestâ limit=â10â ⊠}})
</WANTED DIV>
</div>
{{/if}}
</script>
So far so good. The page looks like this:
The problem is that I donât have any control of the current feed. It is simply the default feed that Iâve roughly targeted the width and position of in my custom css with .custom-homepage + class to make room for the left hand map. It is, for example, currently infinite. I need it to only show say the latest 10 posts.
My question is:
- Which class should I hide in order to hide the current feed?
- What is the correct syntax for adding my latest posts in my own code instead? Please see the âWANTED DIVâ section in the code above.
Live site: https://bygg.boihop.co/
Many thanks for any help on this.