wagtail-metadata icon indicating copy to clipboard operation
wagtail-metadata copied to clipboard

W3C Validator {% block meta %}

Open aurelien-huet opened this issue 1 year ago • 3 comments

The following code is not a valid HTML. You can see screenshot where the W3C validator trigger errors.

{% block meta %}
<meta itemprop="url" content="{{ object.get_meta_url }}">
<meta itemprop="name" content="{{ object.get_meta_title }}">
<meta itemprop="description" content="{{ object.get_meta_description }}">
{% if meta_image %}<meta itemprop="image" content="{{meta_image}}">{% endif %}

<title>{{ object.get_object_title }}</title>
<meta name="description" content="{{ object.get_meta_description }}">
{% endblock meta %}
error-w3c-validator

aurelien-huet avatar May 30 '23 14:05 aurelien-huet

yeah this might be an outdated way to reference these things, I believe the correct syntax is something like <meta name="description" content="description goes here">

seb-b avatar May 30 '23 23:05 seb-b

No that's not right, these are valid tags, they're for schema.org validation. To fix this you should add an itemscope and a relevant itemType to your head element e.g.

<head itemscope itemtype="https://schema.org/WebPage">
  {% meta_tags %}
 </head>

This could be better explained in the readme

seb-b avatar May 30 '23 23:05 seb-b

You're right @seb-b 👍 , it's ok but need documentation

aurelien-huet avatar Jun 03 '23 14:06 aurelien-huet