No Code Attached Yet bug
avatar QuotesUK
QuotesUK
21 Aug 2024

Steps to reproduce the issue

Add article to a Category Blog
View HTML
Relevant line starts with script type="application/ld+json">{"@context":"https://schema.org","@graph":

Expected result

Relative path for schema "image" and "thumbnailUrl" includes forward slash so the relative path points to root and therefore domain/images

Actual result

Forward slash missing from schema "image" and "thumbnailUrl" resulting in relative path pointing to category and therefore non-existent domain/blog/images

System information (as much as possible)

Present in Joomla 5.1.2 and 5.1.3

Additional comments

schema
avatar QuotesUK QuotesUK - open - 21 Aug 2024
avatar joomla-cms-bot joomla-cms-bot - change - 21 Aug 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 21 Aug 2024
avatar fgsw
fgsw - comment - 27 Aug 2024

Issue confirmed (5.2).

avatar Quy Quy - change - 27 Aug 2024
Labels Added: bug
avatar Quy Quy - labeled - 27 Aug 2024
avatar marcorensch
marcorensch - comment - 5 Feb 2025

quick research: all urls should be absolute in schema ld see this stackoverflow solution and linked ressources: stackoverflow

avatar brianteeman
brianteeman - comment - 5 Feb 2025

Issue confirmed. See these test results. Google reports no problems but it also has the WRONG path to the image

Image

avatar brianteeman
brianteeman - comment - 6 Feb 2025

I am not submitting a PR because

  1. I am not 100% certain of everywhere that this needs to be fixed
  2. The schemaorg cache needs to be invalidated before you will see any changes and I dont know how to do that

However the basic fix is to change the code so that the uri root is prepended to the image.

Example

$schema['thumbnailUrl'] = HTMLHelper::_('cleanImageUrl', $article->images->get('image_intro'))->url;
Should be changed to
$schema['thumbnailUrl'] = Uri::root() . HTMLHelper::_('cleanImageUrl', $article->images->get('image_intro'))->url;

Clean Cache

I think the code for this would be
Factory::getCache()->clean('schemaorg');

avatar chmst
chmst - comment - 6 Feb 2025

I think that every single occurence of
HTMLHelper::_('cleanImageUrl'
has to be changed as we don't allow to add images from external sources. (not 100% sure)

avatar brianteeman
brianteeman - comment - 6 Feb 2025

cleanimageurl says it supports absolute image paths as well as relative ones but I dont see how

Add a Comment

Login with GitHub to post a comment