joomla-cms icon indicating copy to clipboard operation
joomla-cms copied to clipboard

[5.4] - Prepend root url to schema images

Open travisrisner opened this issue 2 months ago • 8 comments

Pull Request for Issue #46191 & #43955 .

Summary of Changes

Ensures the root domain is appended to image paths for schema images.

Testing Instructions

  • Ensure the Schema plugin is enabled
  • Edit an article and swap to the Schema tab
  • Set schema type to something with an image (like recipe)
  • Set the image and view the generated schema
  • Note: You might need to clear schema cache (System->Clear Cache)

Actual result BEFORE applying this Pull Request

The images set by schema did not have the root domain prepended and contained extra metadata from joomla about image sizes.

Expected result AFTER applying this Pull Request

The root domain is prepended and the extra information is removed.

Link to documentations

Please select:

  • [ ] Documentation link for docs.joomla.org:

  • [x] No documentation changes for docs.joomla.org needed

  • [ ] Pull Request link for manual.joomla.org:

  • [x] No documentation changes for manual.joomla.org needed

travisrisner avatar Oct 16 '25 20:10 travisrisner

@travisrisner Append? Or did you mean prepend? Append means to add to the end, prepend to the beginning.

richard67 avatar Oct 17 '25 07:10 richard67

@travisrisner Append? Or did you mean prepend? Append means to add to the end, prepend to the beginning.

Good catch, yes prepend!

travisrisner avatar Oct 17 '25 12:10 travisrisner

I have tested this item :white_check_mark: successfully on cd0c8e2a5f92397f71d239fd6edab83b110dd1e1

Before patch: "image": "images/tests/green-tree-frog-256.jpg", After patch: "image": "http://localhost/joomla-cms5/images/tests/green-tree-frog-256.jpg",


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

ceford avatar Nov 04 '25 10:11 ceford

I have tested this item :white_check_mark: successfully on cd0c8e2a5f92397f71d239fd6edab83b110dd1e1


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

mothershedc avatar Nov 04 '25 14:11 mothershedc

RTC


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

richard67 avatar Nov 04 '25 14:11 richard67

@travisrisner I tested this PR before merge and see article's image have absolute URLs now :+1:. And I configured 'System - Schema.org' plugin with an Image. But this logo image has still relative URLs in url and contentUrl:

            "@type": "Organization",
            "@id": "http://localhost:7054/#/schema/Organization/base",
            "name": "Heikos Test Site",
            "url": "http://localhost:7054/",
            "logo": {
                "@type": "ImageObject",
                "@id": "http://localhost:7054/#/schema/ImageObject/logo",
                "url": "images/logo.png",
                "contentUrl": "images/logo.png",

Is it possible to fix Organisation/Person Image absolute URL too?

muhme avatar Nov 06 '25 07:11 muhme

@travisrisner Could you please answer my question? It prevents the PR from being merged. Thank you in advance.

muhme avatar Nov 26 '25 14:11 muhme

@travisrisner Could you please answer my question? It prevents the PR from being merged. Thank you in advance.

@muhme Sorry for the delay! I'll take a look at that Organisation/Person image

travisrisner avatar Dec 04 '25 15:12 travisrisner