wonmew
(Eric)
2019 年12 月 27 日 17:37
1
I want to add a banner on my homepage, not by using the banner topic , because I want to add background image, text, or button.
A very common situation you’ll find yourself in as a theme developer is the need to create content that only shows on the homepage of your community.
You might add some HTML to the “After Header” section of your theme, which will then appear on every page. You can jump through some hoops in CSS to hide this everywhere except the homepage… but instead let’s use a Discourse theme to create a component with content that is only visible on your homepage.
If you’re unfamiliar with Discourse themes …
I followed this topic tried put the first part code into my </head>
then add the rest part to After Header tab, but there is not effect. am I doing something wrong? can I add a customer banner or 2 banners just on my homepage?
1 个赞
hawm
(Hawm)
2019 年12 月 27 日 18:10
2
Yes, you may do something wrong but we cant know that because you didnt show any additional info.
1 个赞
wonmew
(Eric)
2019 年12 月 27 日 18:22
3
this is the code I added in my After Header
<script type="text/x-handlebars" data-template-name="/connectors/below-site-header/custom-
homepage">
{{#if displayCustomHomepage}}
<div class="custom-homepage-wrapper wrap">
<h1>I am John Doe</h1>
<p>And I'm a Photographer</p>
</div>
</div>
</div>
{{/if}}
</script>
if I just add <h1>I am John Doe</h1> <p>And I'm a Photographer</p>
it shows on the top, but not just homepage, it shows every page
1 个赞
dax
(Daniela)
2019 年12 月 27 日 19:20
4
Please, use the search function before posting.
Incidentally, the Versatile Banner has also the function you need.
5 个赞
JimPas
2019 年12 月 27 日 20:57
5
You can also check out this link (which is contained in the topic of Daniela’s link above).
Hello,
I have an issue : I want a specific banner on the homepage only.
I saw that it was possible but I don’t find any subject resolving my problem. Maybe, the fact that I’m still in trial is a factor.
Can you help me please ?
1 个赞
All the code goes in the section not in the after header