- Issue created by @whiz11
- π²πΊMauritius whiz11
Adding temporary patch to get the absolute url for now
- last update
11 months ago 88 pass, 1 fail - Status changed to Postponed: needs info
11 months ago 10:50pm 12 October 2023 - πΊπΈUnited States mark_fullmer Tucson
Thanks for reporting this. You are absolutely (sorry!) right that this module is now designed to provide relative URLs, both for media and for internal links.
Since this issue was written up as specifically relating to the output of media entity URLs using the "Direct URL to media entity" setting, I'm curious whether you do not encounter this as a problem for other types of entity links on the decoupled site? Or do you just reference media entities?
My inclination is that a more comprehensive solution would be to use the Pathologic module ( https://www.drupal.org/project/pathologic β ), added to your text format filters, executing after the Linkit (and any other URL-based) filters, so you can ensure that the links are rendered as absolute, with whatever base URL is appropriate for your decoupled site.
If there's a reason that approach wouldn't work, I'd love to hear about it.
- π²πΊMauritius whiz11
I tried the Pathologic module and it does fit my use case. Thanks for showing the way :)
- π²πΊMauritius whiz11
Actually, there is a nag. I only need this for media entities because we are gettting media files from the backend. But as for other links, they need to stay relative so that it continues work on the frontend. When I use the pathologic module, everything becomes absolute and the issue is if we have links that's supposed to work on the frontend, they stop working since they are now pointing to the backend.
- Status changed to Active
10 months ago 8:01pm 21 November 2023 - πΊπΈUnited States mark_fullmer Tucson
I only need this for media entities because we are gettting media files from the backend. But as for other links, they need to stay relative so that it continues work on the frontend.
Okay, thanks for the additional information. On the surface, this scenario sounds like an edge case that might best be solved by a code-based override to the Media entity suggestion plugin. I can try to work on a proof of concept for that when I have a chance, but I would welcome anyone else who is looking for a similar solution to take that approach and share their solution here.
Setting issue status from "Postponed" to "Active."
- πΊπΈUnited States mark_fullmer Tucson
The attached patch will cause only the "Media" substitution to render an absolute URL, per the request here. This would alter the default behavior of the module, and I don't plan to include this in the module as-is, people needing an absolute URL in this context could patch the module as a solution.
An alternative would be to define a new Substitution plugin (e.g.,
id = "media_absolute"
) that would differ only from the current Media substitution plugin in this small regard shown in the patch. That would allow sites to opt in to this behavioral choice. Unfortunately, it wouldn't retroactively change existing links, since the text markup stores which substitution plugin is used (e.g.,data-entity-substitution="media"
).If/when #3058983: Support changing substitution plugins on a matcher without having to re-enter content β lands, that would no longer be an issue, but for the time being, this is the situation.