We would like to add a personalized schema markup to only one of our blog author bio pages - is that possible? I know that the blog author listing page doesn’t have its own template, and it’s part of the blog listing template, so not sure if there is a way to do this. Is there a way to add the schema to the <head> section for only one particular blog author bio?
Hi @LDewit ,
HubSpot doesn’t natively support adding custom code to the <head> section of individual author bio pages (e.g., /blog/author/author-name). These pages are dynamically generated and don’t have their own editable templates. While HubSpot allows adding custom head HTML for blog posts, it doesn’t offer this option for author pages.
Based on AI suggestions, there are a couple of workarounds you can try using HubL conditional logic in the main blog listing template, which is typically inherited by author pages.
Option 1: Conditional Schema Markup Based on Author
You can add schema markup in the <head> section of your blog listing template and wrap it with an if condition based on the author slug:
{% if content.author.slug == "john-doe" %}
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "Person",
"name": "John Doe",
"jobTitle": "Content Strategist",
"url": "{{ request.full_url }}",
"sameAs": [
"https://www.linkedin.com/in/johndoe/",
"https://twitter.com/johndoe"
]
}
</script>
{% endif %}
Add this code to the <head> section of your blog-listing.html or blog.html file in the Design Manager.
Option 2: HubDB for Multiple Authors
If you want to manage schema for several authors:
- Create a HubDB table with columns for slug and schema_markup.
- In your blog template, use:
{% set author_schema = hubdb_table_rows(table_id, "slug=" + content.blog_post_author.slug) %}
{% if author_schema %}
<script type="application/ld+json">
{{ author_schema[0].schema_markup }}
</script>
{% endif %}
This keeps things cleaner if you’re managing multiple author profiles with unique schema.
Let me know if this works for you. If not, I’ll tag a few HubSpot developer experts here who may have more ideas.
Hope this helps!
Thank you for your help here - would I add it to the “Header HTML” section in the blog template in Hubspot settings (vs in the Design Manager)? And going with option 1, wouldn’t the author variable be: content.blog_post_author.slug?
Hi @LDewit ,
No, the “Header HTML” section in HubSpot blog settings is not dynamic and doesn’t support HubL logic (like if statements). You need to place this code inside your blog listing template file in Design Manager, specifically in the <head> section.
- Navigate to Marketing > Files and Templates > Design Tools
- Open your blog listing template (typically named blog-listing.html or similar)
- Add the conditional schema code within the <head> block
Hi @ArisudanTiwari,
I got this to work with your help, thank you! Option 1 worked using the conditional based on author, but wasn’t working with the content.blog_post_author variable .slug property for some reason. This property worked: {% if blog_author.display_name == “John Doe” %}
Thank you again!