@jjimeno HubL doesn't work in .js files is why it doesn't work there. You would need to add it into the HTML. The javascript will completely rewrite the tags. What I meant about "adding a meta tag directly into the template" was just adding the meta tag instead of writing it with javascript (<meta name="description">Your meta here</meta>) -- that's the solution that could cause discrepancies, not the javascript workaround.
If this answer solved your question, please mark it as the solution.
@dennisedson we are building our blog pages locally. @John, yes this how we store the metadata for the blog tags. 🙂
@alyssamwilie I have tried changing them using javascript but added the codes in the .js file. I will try your suggestion which is to add it to the template, however, there are already existing meta tags for that page as you have mentioned and it might not work. But ill give it a try and get back to you.
@jjimeno HubL doesn't work in .js files is why it doesn't work there. You would need to add it into the HTML. The javascript will completely rewrite the tags. What I meant about "adding a meta tag directly into the template" was just adding the meta tag instead of writing it with javascript (<meta name="description">Your meta here</meta>) -- that's the solution that could cause discrepancies, not the javascript workaround.
If this answer solved your question, please mark it as the solution.
@jjimeno Hubspot currently does not have a built in way to change these. Not sure when it'll become available as there's been an Ideas post for it since 2018 which I would recommend upvoting. You can however change them using javascript.
{% if topic %}
<script>
document.title = "Change Title | {{ topic|title }}";
document.querySelector('meta[name="description"]').setAttribute("content", "Change Topic Description of {{ topic|title }}");
</script>
{% endif %}
Just add to the "Additional markup before </body>" field in your drag and drop template or somewhere before the </body> tag in your code if you're using a coded template.
You could also try just adding a meta tag directly into the template but it's possible the Hubspot generated one will be given priority over the new one and not work.
If this answer solved your question, please mark it as the solution.
First of all how are you building your blog pages? Are you using the drag and drop or are you coding (either in Design Manager or locally)? It will make a difference in how you solve this one