Hey team, how can I have a Builder page pull its “Page fields” (e.g. SEO page title / description) and its Open Graph Tags dynamically from a custom model in Builder?
We built a model (called Stories) that allows us to publish individual news stories. I’m trying to create an article page that references this model.
For pages hosted by Builder, pulling page fields and open graph content dynamically is unfortunately not currently available. Happy to pass this note to our team to get this into our roadmap at some point.
If you are hosting Builder content yourself (e.g. with React), you can do this as described here.
If you have any other questions, feel free to reach back out
Fresh off the press - this is now possible with Builder hosted sites too.
In your custom JS code you can create a metaTags object and put any meta tag name and values on there, and they will show up on your page rendered by Builder in the
@steve the meta tag functionality has been working smoothly, but we’re running into an issue where some unrelated tracking / pixel code in the <head> stops working properly on pages where we use this feature (i.e. we noticed Google Analytics and our Snap pixel breaks).
More specifically, any page for us that ends with “/news” for us doesn’t appear in Google analytics (in addition to other pixel and tracking-related issues). On the contrary, pages that end in “/candy” for us (which are dynamic URLs, but don’t use the meta tag feature) work just fine.
After digging into it, we noticed that some random parts of the head HTML seem to be changing.
Thanks for the detailed response and screenshots! I know we already connected via slack, but wanted to post here as well.
We’ve found a bug with our HTML parsing that can cause this to happen, but you can get around it in the meantime by having one space between opening and closing tag. Let me know if you have any questions!
Where href is the link to your favicon image, you can upload images and get an instant cdn link on builder.io/upload , then copy the link and add it to the href attribute in the example above.
It looks like there’s a small bug in state.customHeadHtml when used in combination with state.metaTags: it renders <html><head> before the content, but we’re already in the <head>. The <meta> tags end up in the <body>.