alanorth / hugo-theme-bootstrap4-blog

A blogging-centric Bootstrap v4 theme for the Hugo static site generator.
Other
204 stars 132 forks source link

Do not escape characters in formatted date #111

Closed vincevriend closed 5 years ago

vincevriend commented 5 years ago

Remove quotes in the template so that the '+' character will no longer needlessly be escaped as '\x2b'.
Because the + character is part of the datetime it will render an invalid date in the JSON Linked Data, which may hurt SEO.

Without this fix:

<script type="application/ld+json">
...
"dateModified": "2014-09-28T00:00:00\x2b00:00",
...
</script>

With this fix:

<script type="application/ld+json">
...
"dateModified": "2014-09-28T00:00:00+00:00",
...
</script>
alanorth commented 5 years ago

You're absolutely right. Even Google's Structured Data Testing Tool notices that this is malformed JSON-LD in one of my latest blog posts:

Screenshot_2019-06-20 Structured Data Testing Tool-fs8

Thank you for this, @TommySprat.