Hey all,
My website https://web3plusai.xyz/ is using Source (default) 1.5.0 theme, but I want to get my content organized into sections as per the different tags each article is applied. Is this possible?
What I want to achieve is similar to what the Headline theme looks like - different content categories on the homepage. Yet, I read that the Source theme does not respect routing.
Thanks in advance!
You’re wanting multiple sections on the homepage? That’s not really a routing issue. (I’ve said lots of times that Source doesn’t respect routing, but what I mean by that is that if you wanted to upload a routes.yaml to change what’s on the homepage it wouldn’t work. That’s not your problem here.)
What you’d want to do is basically duplicate a chunk of Source’s existing home.hbs (or index.hbs, if there’s not a home – I don’t recall off the top of my head). Then you’d alter the existing (and duplicated) #get requests to include a filter argument, so that each section can have separate tags.
Looking at the source of headline might be a good place to start, but basically you’re either going to have sections that look like this:
{{#get "posts" filter="tag:my-tag1" limit=5}}
{{#foreach posts}}
{{> loop}} {{!-- this calls partials/loop.hbs render each post. Name varies by theme --}}
{{/foreach}}
{{/get}}
{{#get "posts" filter="tag:my-tag2" limit=5}}
{{#foreach posts}}
{{> loop}} {{!-- this calls partials/loop.hbs render each post. Name varies by theme --}}
{{/foreach}}
{{/get}}
... etc
Hey, thank you for your answer!
Yes, that’s exactly what I want - tag-specific section on my homepage.
However, looks like this solution would require me to upgrade and pay more, so it doesn’t work for me.
Thanks anyway.
If you’re on a plan that doesn’t allow paid/custom theme, take a look at headline, plus maybe some code injection if you want a little different styling.
1 Like