joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.77k stars 3.65k forks source link

[5.0] Schema - wrong Date Format #42196

Open Mich-es opened 1 year ago

Mich-es commented 1 year ago

Steps to reproduce the issue

Localize Timezone Berlin, switch to german language Setup schema, fill out the date with the Date-Picker Test the Site: https://search.google.com/test/rich-results?hl=de

Expected result

That will be everything correct

Actual result

screen shot 2023-10-22 at 02 58 34

System information (as much as possible)

PHP 8.2 Joomla 5

Additional comments

Tested with: https://search.google.com/test/rich-results?hl=de

richard67 commented 1 year ago

For schema.org it is valid because they allow both date and datetime values for the datePublished property, see https://schema.org/datePublished . They refer to ISO_8601 for both, and for dates without time the provided format is valid, see e.g. https://en.wikipedia.org/wiki/ISO_8601 .

However, Google seems to expect datetime values, and those require the time and timezone part, see https://schema.org/DateTime .

So I think it should be fixed to make Google happy.

richard67 commented 1 year ago

When not using the manually entered schema.org data for an article but the automatically generated one (there are 2 switches for that in the options of the "Content - Joomla" plugin), I get valid datetimes for dateCreated and dateModified, i.e. with time and time zone. So it seems to be only an issue when using manually entered data.

Mich-es commented 1 year ago

@richard67 Thank, what do u mean with: "there are 2 switches for that in the options of the "Content - Joomla" plugin"


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/42196.

richard67 commented 1 year ago

@Mich-es In the options (settings) of the content plugin "Content - Joomla" are 2 switches, one for Articles and one for Contacts. When a switch is switched on, schema.org data is added based on article title and so on like it was in Joomla 4 with the html markup. Don't ask me now for the labels of these switches, but you will easily find them when editing the "Content - Joomla" plugin's option.

HLeithner commented 1 year ago

So what should the format be? is google only happy with this? 2023-10-22T07:07:59−07:00

if yes then we need a new SchemaorgPrepareDateTimeTrait more or less a copy of SchemaorgPrepareDateTrait with the full datetime string and of course changed where it should be used.

richard67 commented 1 year ago

2023-10-22T07:07:59−07:00

The time zone part is optional, and with UTC times we could use 2023-10-22T07:07:59Z.

But the time part Thh:mm:ss is not optional for Google, it seems, i.e. they only accept datetime and not date like schema.org does.