? ? Language Change Composer Dependency Changed ? Pending

User tests: Successful: Unsuccessful:

avatar wilsonge
wilsonge
4 Jun 2019

Why Schema.org

  • Used by bing, google, yahoo and yandex
  • We've been using it for a long time now

Why JSON Over inline

Why the Spatie\SchemaOrg library

  • I like the fluid design and I think it's going to allow easy triggering of plugin events to allow easy custom enhancements
  • I don't think that people are template overriding these things much - the main issue is context - which templates don't have either. Generally plugins are better suited to provide context about an individual website

Why remove the microdata library?

  • We aren't updating the types
  • We aren't using it in core (too much PHP - we just hardcoded things)

Things that need to be done

  • Base Web page entity
  • Fix language code plugin inLanguage
  • Remove all the remaining itemProps and move to schema.org definitions where required
  • Plugin events
  • Publisher (either Person or organisation - see the section "Structured data in Yoast SEO" https://yoast.com/yoast-seo-11-0/ for an example)

Questions

  • Should be keep this as a separate entity in JDocument to allow even easier customisation?

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar wilsonge wilsonge - open - 4 Jun 2019
avatar wilsonge wilsonge - change - 4 Jun 2019
Status New Pending
avatar wilsonge wilsonge - change - 4 Jun 2019
Title
Use schema.org for metadata
[4.0] [RFC] Use schema.org for metadata
avatar wilsonge wilsonge - edited - 4 Jun 2019
avatar joomla-cms-bot joomla-cms-bot - change - 4 Jun 2019
Category Front End com_contact com_content External Library Composer Change Layout Libraries Unit Tests
avatar brianteeman
brianteeman - comment - 4 Jun 2019

Perhaps stating the obvious but surely we cant remove a library without it first being marked as deprecated? Just because we dont use it in core doesnt mean its not being used.

avatar brianteeman
brianteeman - comment - 4 Jun 2019

For the publisher part I would add two new fields to Global Config in the Metadata section - publisher name and publisher logo and then in the code you could also have a fallback of ->name($app->get('sitename')) if the name is empty

avatar ReLater
ReLater - comment - 4 Jun 2019

I think this would be a big step forward:

  • as long customization of the ld+JSON output will be fully possible by custom plugins.
    e.g. use case: Use a global fall back image if no image found.
    Use another publisher than found.

  • as long ld+JSON output can be deactivated globally or per component(?)
    e.g. use case: Custom plugins that use their own "logic" when, how, what and where to show ld+JSON. And are providing their data since years for search engines.
    And are providing more informations for other systems than search engines.

Just a suggestion to reduce page output: Output only if search bots are indexing the page. Simple
if $app->client->robot
should be sufficient.

avatar wilsonge wilsonge - change - 4 Jun 2019
The description was changed
avatar wilsonge wilsonge - edited - 4 Jun 2019
avatar wilsonge wilsonge - change - 4 Jun 2019
Labels Added: ? ? ? ?
avatar wilsonge
wilsonge - comment - 4 Jun 2019

Perhaps stating the obvious but surely we cant remove a library without it first being marked as deprecated? Just because we dont use it in core doesnt mean its not being used.

Yup - i'll do a PR to deprecate in 3.10 if we do. In this case given it's very outdated I think it's justified

avatar brianteeman
brianteeman - comment - 4 Jun 2019

Perhaps stating the obvious but surely we cant remove a library without it first being marked as deprecated? Just because we dont use it in core doesnt mean its not being used.

Yup - i'll do a PR to deprecate in 3.10 if we do. In this case given it's very outdated I think it's justified

There has already been a conversation elsewhere on the tracker that deprecating in 3.10 is not acceptable because 3.10 and 4.0 are released on the same day so there is no notice

avatar ReLater
ReLater - comment - 4 Jun 2019

Duplicating the entire article text into JSON?

In the past articleBody (= entire article text; but normally with strip_tags, removed newlines and so on) inside ld+JSON was required by Google but then they removed the required and it's optional now. On the other hand: If a page markup is not perfect and it's not easy to identify the main content articleBody can be helpful. Also for other readers than search engines. But, yes, it can become a overhead.

See my comment concerning customization possibilities via custom plugins.

avatar mbabker
mbabker - comment - 4 Jun 2019

There has already been a conversation elsewhere on the tracker that deprecating in 3.10 is not acceptable because 3.10 and 4.0 are released on the same day so there is no notice

Short notice deprecations without strong reasoning (i.e. security issues). Something that's outdated, while not ideal, doesn't necessarily mean that's a good candidate for a short notice deprecation. Yes, I'm fully aware there is no documented requirement for number of versions an API element must be deprecated before it can be removed, but this is about ecosystem relations. I get the intentions here and with the PR's from Hannes that I completely tore apart, and I get the argument a lot of people are going to throw around about support overlap and "oh you have 2 years to get your code updated", but I don't think it's very ecosystem friendly to introduce new deprecations in 3.10 for things to be completely removed in 4.0 (and let's be real here, a lot of the ecosystem doesn't keep up with this repo so when the stable release comes around, that will be their first alert about the deprecation).

avatar brianteeman
brianteeman - comment - 4 Jun 2019

Thinking about this PR over lunch and realised there is one major issue between this approach and the previous one. Before you could customise the metadata in your template override as it was all in the tmpl/ but now its all in the /View so you can't (at least I dont know how to)

avatar mbabker
mbabker - comment - 4 Jun 2019

Before you could customise the metadata in your template override as it was all in the tmpl/ but now its all in the /View so you can't (at least I dont know how to)

It needs a plugin event after the Schema object is finished being built and before it gets added to the document. Otherwise trying to manipulate the JSON string attached to the document in something like onAfterDispatch defeats the point of using the underlying library if anyone trying to further customize the schema doesn't even have access to it.

avatar wilsonge
wilsonge - comment - 4 Jun 2019

It needs a plugin event after the Schema object is finished being built and before it gets added to the document. Otherwise trying to manipulate the JSON string attached to the document in something like onAfterDispatch defeats the point of using the underlying library if anyone trying to further customize the schema doesn't even have access to it.

Which is why i have Plugin events listed in my todo section :) that's exactly the intention. I also explained why plugin events over template overrides in the Why the Spatie\SchemaOrg library section :)

avatar richard67
richard67 - comment - 4 Jun 2019

@wilsonge

I don't think that people are template overriding these things much

That's not true, I had to override it all the times, e.g. to change the item type from article to blog posing for articles which appear in a category blog, or to add the missing "name" property, which Google validator claims to be mandatory.

avatar joeforjoomla
joeforjoomla - comment - 4 Jun 2019

Although the json-ld VS Microdata is a bit more modern approach to deal with Schema.org, probably from a user perspective with average skills it's much more easy to override them now than having to write a plugin and manage Plugin Events.
So definitely there are pros and cons... maybe more cons?
Maybe a possible solution would be a parameter to switch between Microdata and Json-LD? Or something to have Json-LD easily overridable?

avatar mbabker
mbabker - comment - 4 Jun 2019

from a user perspective with average skills it's much more easy to override them now than having to write a plugin and manage Plugin Events

The admin UI, and the template files as a result, are already overly convoluted. The "right" way to do it and be the most user friendly practical would be adding all this stuff on metadata tabs on all the content types (articles, contacts, categories, etc.). Otherwise you're putting too many conditionals in a default.php template file to decide if something is an Article or BlogPost or some other "root" type. Even supporting this PHP library's API, to have options for the key bits that need flexibility is adding a lot of fields to the admin UI.

A plugin has the benefit of having access to all of the data needed (well, let's be real here, thanks to the lack of separation of concerns in the Joomla API a template file does too). It has the ability to programmatically make decisions that cannot be configured in the existing com_content UI (or any other core component). There shouldn't be a fear of using plugins for altering the system behavior, that's exactly how an event driven system should work, except Joomla really isn't an event driven system (the events that exist are really crippled IMO and mostly restricted to MVC contexts, very few of the library APIs have event support and that's a major issue). The only "problem" with them is they require you to be good at Joomla's version of PHP, being able to do everything in template files requires you to mostly understand HTML and to a lesser degree have an understanding of Joomla's version of PHP to decipher the over-engineered template file you're trying to edit because there are way too many PHP statements within them.

avatar simbus82
simbus82 - comment - 4 Jun 2019

Although the json-ld VS Microdata is a bit more modern approach to deal with Schema.org, probably from a user perspective with average skills it's much more easy to override them now than having to write a plugin and manage Plugin Events.
So definitely there are pros and cons... maybe more cons?
Maybe a possible solution would be a parameter to switch between Microdata and Json-LD? Or something to have Json-LD easily overridable?

I hope there is no doubt about the use of only Json-LD. But Microdata mixed with HTML, no thanks!
It would be nice to have the opportunity to decide where and how to activate structured data. For example, then will I be able to do a FAQPage? Or will the superimposed "article" microdata prevent me from adding the structured data I want?
At the moment I do well on J3 with the excellent Tassos plugin (Google Structured Data).
The JCE editor also allows the use of structured data, but uses the logic of microdata mixed with html, which is a horrible and disused thing.
But actually I feel the lack of something at the core level ... well done and configurable.
This PR, however, is a turning point !!! Thank you guys!

avatar joeforjoomla
joeforjoomla - comment - 4 Jun 2019

At the moment I do well on J3 with the excellent Tassos plugin (Google Structured Data).

So definitely would not be better to clean up the HTML code from all mixed Microdata and leave this feature to third-party extensions that fully cover all types of schema.org and configurations?

avatar simbus82
simbus82 - comment - 4 Jun 2019

At the moment I do well on J3 with the excellent Tassos plugin (Google Structured Data).

So definitely would not be better to clean up the HTML code from all mixed Microdata and leave this feature to third-party extensions that fully cover all types of schema.org and configurations?

I cannot comment on this. If I could decide I would add these and many other things to the core. But in this way the developer community would die and the main team should follow every evolution working incessantly only to act on the news ... for example just a few weeks ago Google accepted in the SERP the FAQPage, who should work on the structured Joomla data in that case? The main team or third-party developer?
I really can't answer!

avatar wilsonge wilsonge - change - 5 Jun 2019
Labels Added: ?
Removed: ?
avatar richard67
richard67 - comment - 5 Jun 2019

Well, I don't want to vote pro or con. My knowledge on Joomla architecture how it is and how it should be is too little. I only wanted to say that there is at least 1 person doing overrides for modifying the microdata stuff in J3. Would be less comfortable for me having to write a plugin, but if that's the better way, then go for it.

avatar mbabker
mbabker - comment - 5 Jun 2019

The underlying library (something I'm using on a number of projects) has the benefit of being a fully documented PHP library, and is pretty self-documenting as far as what you can do and where. It's going to add the benefit of having some basic validation in place because it's a collection of PHP classes, whereas the current solution is basically "plug some stuff into a layout, upload it, put it through Google's parser, lather, rinse, repeat". Yes, it's "harder" to be expected to write some PHP code, but in the long run you're getting a standards compliant library that can help guide users over the current solution of hope for the best, and you're opening the door to allow developers to more fluently integrate with this aspect of the page rendering process instead of resorting to the hacks you have to use now because as a plugin developer you can't "force" a template layout file (as one example).

avatar richard67
richard67 - comment - 5 Jun 2019

It's this one, right? https://github.com/spatie/schema-org

Reads not bad and looks well maintained.

avatar mbabker
mbabker - comment - 5 Jun 2019

Correct.

avatar ReLater
ReLater - comment - 4 Aug 2019

Not important yet! Just a hint because I use the Spaty library in Joomla 3 in a plugin:

$this->document->addScriptDeclaration(json_encode($schema, JDEBUG ? JSON_PRETTY_PRINT : 0), 'application/ld+json');

addScriptDeclaration results in an invalid JSON structure in <script> tag if you output several schemas.

E.g. Organization and Article

<script type="application/ld+json">
{
    "@context": "https:\/\/schema.org",
    "@type": "Organization",
--- AND SO ON ---
}
// ! MISSING COMMA HERE !
{
    "@context": "https:\/\/schema.org",
    "@type": "Article",
--- AND SO ON ---
}
</script>
avatar joomla-cms-bot joomla-cms-bot - change - 15 Sep 2019
Category Front End com_contact com_content External Library Composer Change Layout Libraries Unit Tests Administration com_config Language & Strings Front End com_contact com_content External Library Composer Change Layout Libraries Unit Tests
avatar wilsonge wilsonge - change - 15 Sep 2019
Labels Added: ?
avatar AndySDH
AndySDH - comment - 17 Feb 2021

Was this abandoned? I see J4 is still using microdata instead of JSON-LD

avatar wilsonge
wilsonge - comment - 17 Feb 2021

I never got time to do anymore work on it. And likely won't before 4.0 ships - just too many things to work on and my personal life means I have limited time for Joomla right now (I'm buying my first house which needs quite a lot of builders arranged). So yes it's not going to hit 4.0 for sure.

avatar AndySDH
AndySDH - comment - 17 Feb 2021

Congrats on the first house @wilsonge!

I guess in the meanwhile we'll have to keep using this :) https://www.tassos.gr/joomla-extensions/google-structured-data-markup/

avatar rdeutz rdeutz - change - 15 Mar 2021
Title
[4.0] [RFC] Use schema.org for metadata
[4.1] [RFC] Use schema.org for metadata
avatar rdeutz rdeutz - edited - 15 Mar 2021
avatar hans2103
hans2103 - comment - 11 May 2021

@wilsonge J4.1 ?
I'dd love to help on this implementation. Looks great!


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

avatar wilsonge wilsonge - change - 20 Jun 2022
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2022-06-20 23:13:57
Closed_By wilsonge
Labels Added: ? ? Language Change Composer Dependency Changed ?
Removed: ? ? ? ? ?
avatar wilsonge wilsonge - close - 20 Jun 2022
avatar wilsonge
wilsonge - comment - 20 Jun 2022

I don't have the time right now to keep this going. It's a huge change because it needs extra site metadata (per my comments in the main PR description) we don't currently have and without it thing can get worse from an SEO perspective than better - which is obviously a major upgrade issue. @HLeithner / @bembelimen might be one to pick up as a gsoc project for v5.

avatar wilsonge
wilsonge - comment - 20 Jun 2022

Always ahead of me :) Obviously feel free to use this as a starting point

avatar bembelimen
bembelimen - comment - 20 Jun 2022

We already do

Add a Comment

Login with GitHub to post a comment