No way
. Google scan the source code (cms if --hidden not remove the element node). It’s ok to put under reviews count the value 0 (of course u won’t get stars under search results).
Hey @Siton_Systems really useful post thanks!
I’ve been trying to build custom FAQ schema using dynamic fields, and wanted to only run the schema for pages where I’ve added the CMS content (FAQ).
I have been trying to get this code working, but something is wrong - i don’t suppose you know any JS?!
For a list of items (list of articles, reviews, FAQ, and so on) easier to use microdata
(Not JSON-LD
) and custom data attributes (Not very complex because you add data-attributes only one time (one item) for the entire list).
** For now, no way to generate JSON list from CMS items (under custom code).
Hi all, has anyone been able to successfully setup up Product Schema with product variants in webflow?
Hi,
I have a problem adding structured data to my Webflow website.
I have a website with recipes and I have to add the ingredients to the structured data.
They need to be all separate and between “”.
So when fill in the ingredients in the text field I created for this the rendered code changes the " for "
Now I could replace this field and make a separate field for each ingredient but there are only 30 fields and the instuctions of the recipe has to be structured the same.
So I don’t have enough fields!
Does anyone have a solution for this problem?
thanks!
I know I’m reviving an old thread here, but I thought I’d give some info on how to solve the issue @John_Wright posted about above.
Here’s how to add dynamically-generated structured data from within Webflow. Navigate to your template’s custom code, inside < head > tag field. This example adds structured data to my Post CMS model only if it has a Category of Recipe.
{{Category}} = my CMS field called Category
<script type="text/javascript">
if ("{{Category}}" == "Recipes") {
var s = document.createElement("script");
s.type = "application/ld+json";
// escape double-quotes with backslash
s.innerHTML = "{\"@type\": \"Recipe\", \"name\": \"{{Name}}\"}";
var head = document.getElementsByTagName("head")[0];
head.appendChild(s);
}
</script>
If you want to add certain structured data fields conditionally, simply change how s.innerHTML
is constructed.
Thanks for the solution Michael, i’m using a different one: Change JSON schema from CMS (content + type of schema) - #2 by Evan1
And here is how I expand a FAQ schema depending on the number of questions on the page (when you have a FAQ page and keep adding questions to your CMS):
``
(For some reason my code only shows in edit mode)
Hi all!
Quick question, if I update a blog template with structured data, it will update the previously written blogs?
Or do I need to add the data manually one by one?
It’s for a client website, and I need to figure out the time it will take me to add a structured date.
Many thanks!
@Laura_Moreno, yes it should update all pages using the template.
Hello @Siton_Systems ,
In your Update of 2019, it seems you manage to pull Author and Categories from another collection (that is referenced in your post collection).
How do you do that? I have the Author & Category collections that are used in my BLog Post Collection, but I can’t access them in the Custom Code Editor.
Thanks for the help
Hi @QH33, have a look here: Include referenced items from other CMS collection in SEO schema script - #2 by felixz
I struggled with it at first as well.
Hello guys,
One last question, did you find an efficient way of having a clean field for the articleBody schema.org element? (meaning, inline without any html balise)
Of course, it’s possible to create a specific field and paste all the article body without HTML markup, but it’s quite long.
Any suggestions would be appreciated.
Cheers!
Hi all and thanks @Siton_Systems for your step-by-step guides and screenshots! So helpful - and I was able to successfully apply to the blog CMS pages of my website by adding JSON-LD to the head tag.
I want to be able to add “Person” schema to our team member pages (CMS) and include a ‘sameAs’ property for each team member (that links to social profiles, etc). The information will be different for each team member - but I don’t have that information populated in any of the existing fields in the CMS (and therefore wouldn’t be able to create custom fields in the head tag). I tried creating JSON-LD for each team member page and embedding the script in the body section - but schema.org isn’t detecting any schema.
Do you have any suggestions? Thanks for your help.
Can I see your website, please? You can add Schema on each individual CMS item.
Is this still not automated? For csv rewriting do you need to set up all of the structured data fields on your own?
i also wander what seo folks at webflow has to offer, thank u
For anyone who wants to put FAQ rich snippets on their site - check out this super easy solution, you just need to add 2 attributes and you’re good to go! It also updated with your content, so no need to make double edits.
<!-- 💙 MEMBERSCRIPT #35 v0.1 💙 FAQ RICH SNIPPETS -->
<script>
let faqArray = [];
let questionElements = document.querySelectorAll('[ms-code-snippet-q]');
let answerElements = document.querySelectorAll('[ms-code-snippet-a]');
for (let i = 0; i < questionElements.length; i++) {
let question = questionElements[i].innerText;
let answer = '';
for (let j = 0; j < answerElements.length; j++) {
if (questionElements[i].getAttribute('ms-code-snippet-q') === answerElements[j].getAttribute('ms-code-snippet-a')) {
answer = answerElements[j].innerText;
break;
}
}
faqArray.push({
"@type": "Question",
"name": question,
"acceptedAnswer": {
"@type": "Answer",
"text": answer
}
});
}
let faqSchema = {
"@context": "https://schema.org",
"@type": "FAQPage",
"mainEntity": faqArray
}
let script = document.createElement('script');
script.type = "application/ld+json";
script.innerHTML = JSON.stringify(faqSchema);
document.getElementsByTagName('head')[0].appendChild(script);
</script>
Wondering if anyone has a solution to this.
I want to create structured data for some courses that are offered. They are all their own CMS items, fields for items I can pull e.g. start date, end date, name, description, etc.
My scenario is: I have 2 types of courses. 1 is in person for 3 days, and 1 is online zoom courses that can be either 2 days or 3 days.
For the online zoom courses, they can either pay for all 3 days, or pay individually for the day that they want. So there are price fields for all 3 days (Total Price), day 1, day 2, and day 3.
The in-person course only has 1 price, so only the Total Price field is filled out.
How would you set up the structured data for this scenario in the cms template structured data? Are there best practices?
The structured data info I’ve found seem simple, so I’m also wondering if I’m just overthinking things!
Hi Gerald, it’s not clear if you’re asking about how to structure the schema, or how to deliver it from a CMS item.
There are no “best practices” per-se, because it depends entirely on how you want to store and manage your schema. If you want to use JSON-LD, you can store it as raw JSON inside of a rich text CMS field ( within an HTML Embed sub-element in your rich-text content ). But that necessitates raw JSON editing, which gives you maximum power but is not ideal when clients are editing their own content.
If all of the content you are delivering can be structured in the page as elements, you can tag them using RDFa attributes and structures instead,
As far as the schema itself, just follow the schema.org guidelines on what you want to create. Your scenario is pretty straightforward.
Honestly I have been using Chatgpt to generate my Schema and it is working like a charm. Instant time saver.