Streaming live at 10am (PST)

Adding a prefix (or suffix) to dynamic CMS heading


#1

So I've used the CMS to set up, in effect, a blog. Each post is categories, and I have a 'categories' page which pulls in the relevant stories for that category (using filtering). All well and good.

My question is that currently I'm using an H1 tag which is dynamically populated from the category:

The issue I have is that rather than just the name of the category, I'd prefer to append 'news' or something similar to the H1. For example, if one of my categories is "Construction", I'd want to have the H1 to say "Construction News", rather than just "Construction". There doesn't seem to be any easy way to do this, and I'd rather not have two H1s right next to each other (one dynamically populated, and the other just containing 'News'), for accessibility considerations.

Any suggestions?


#2

Another collection data field within each categorie as a text field, with the appendix?

like...

"Construction News" -> this feed then gets to the h1 element ?
(yeah you have to type them all in).

Another method maybe with custom code.
Give your h1 an id like ... #product-headline.

Then go to the collection template page and add this custom code:

<script>
$('h1#product-headline').append(' News');
</script>

Only visible after publishing :stuck_out_tongue_winking_eye:.

Regards
Daniel


#3

Thanks Dan - was hoping for something a bit more elegant, but resorted to the jQuery solution suggested.

Had to also include the jQuery script link into the custom site code, as it was previously included (by default, seemingly) in the footer, and therefore being called after the custom code - which threw an error.

Seems like something that could/should be possible to do through the Webflow interface, but perhaps not yet.


#4