[5.4] - Prepend root url to schema images
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 Append? Or did you mean prepend? Append means to add to the end, prepend to the beginning.
@travisrisner Append? Or did you mean prepend? Append means to add to the end, prepend to the beginning.
Good catch, yes prepend!
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.
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.
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46306.
@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?
@travisrisner Could you please answer my question? It prevents the PR from being merged. Thank you in advance.
@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