I’ve added schema data to my page HTML header.
It shows up fine in the page source.
The code itself is validated correctly using https://validator.schema.org/
The weird thing: if I try to validate the url itself, the whole script that is in my page html header doesn’t show up, neither does it in google’s tools…
Can’t figure out why for the life of me
Anyone ran into the same issue or has a pointer?
Help would be much appreciated!
For that someone running into something like this in the future…
I found the issue. Not related to schema.
There was a ‘bug’ in the <link> tag above. I closed that with />. Apparently either bubble or google does NOT like that. When I removed it all was fixed.
It’s weird, because although not mandatory, it is allowed in html5 spec…
Ah well.
Thanks!
Yeah the canonical wasn’t related to the schema code. It was already there (need it because the build in canonical wasn’t working well for me).
But yes, for anyone else just focussing on the schema data. No need to include the <link>
That is interesting…I am in need of becoming more familiar with canonical URL and thought the built in was mostly just for the index page, but I need it for my listings page.
Is the method you used in the header all that is needed to setup the canonical for a specific page, so that if for instance I had a page for event listing and another for job listing, I could create the canonicals for them on their respective pages?
Yeah! Works like that.
I use the ‘get path from page url’ on top of the base url to make sure there are no url parameters in it. Which is the exact thing you want to avoid (otherwise you have lots of duplicate pages with slightly differing urls.
You could also do this using ‘this url’ and then split on ‘?’ I would think. But haven’t tried it.