The Drupal 7 version used to render the URL alias if it could, but I can't get the 8.x version to do it.
Using 'Protocol relative URL', and entering a path of "/node/2" the output is http://example/node/2
But I would expect it to be http://example.com/alias-of-node-2
Using Url::fromUserInput instead of Url::fromUri seems to achieve this so I'll add a patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #32 | pathologic-2692641-32-path-alias.patch | 964 bytes | alexander tallqvist |
Issue fork pathologic-2692641
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
rikki_iki commentedComment #4
kristofferwiklund commentedWorks great.
Comment #5
acbramley commentedI was having the same issue, once I applied the patch from #2418369: Internal URL handling (language prefixes, base://, ...) it fixed it for me.
EDIT: https://www.drupal.org/files/issues/2418369-7.patch this one to be clear.
Comment #6
jhodgdonAgreed. I think that the patch referenced in #5 here is preferable to the patch in this issue, so I'm setting this issue to Needs Work. Perhaps it should be marked as a duplicate?
Comment #7
nplowman commentedI'm attaching an updated version of the patch which should apply cleanly with the latest Dev version.
Comment #8
derhasi commentedComment #9
derhasi commentedThis should be fixed with the latest patch in #2418369: Internal URL handling (language prefixes, base://, ...). Can you have a try on that?
@nplowman I guess base_path() will not catch all use cases, like files beeing detected by pathologic, as mentioned by @jhodgdon in that issue.
Comment #10
Mike Dodd commentedLatest patch works great for me, thank you
Comment #11
steveoriolI created a patch that works better for me on D8.5.1, if it helps ...
Comment #12
sittard commentedAny chance we could get this patch rolled out to the next release? Thanks.
Comment #13
steveoriolThe patch #11 should still works for D8.6.4 and pathologic 8.x-1.0-alpha1
Comment #14
fox mulder commented#11 solves the problem
Comment #15
moshe weitzman commentedI think this issue has a more minimalist approach than #2418369: Internal URL handling (language prefixes, base://, ...) and therefore should stay open. I implore the maintainers to do something on this issue. Attached is a variant on this patch, but we let Url do the alias lookup instead of doing it ourselves. Its just 2 lines.
Comment #16
nitrospectide commentedI just applied Moshe's patch, and it works beautifully. I'm all for elegant, simple approaches.
Can #15 be committed and released?
Comment #17
moshe weitzman commentedRTBC based on last review
Comment #19
ab2211 commented#11 doesn't help me. Drupal 8.9.8 and 8.x-1.0-alpha2.
Comment #20
federiko_ commentedI can confirm that patch #15 works perfectly.
Aliases are now showing into my blocks bodies.
> Drupal 9.1.4 / Pathologic 8.x-1.0-alpha2
Comment #21
philypatch #15 works for me using Drupal 8.9.13 and Pathologic 8.x-1.0-alpha2
Thanks
Comment #22
ab2211 commentedHm, patch #15 did not help.
Comment #23
andrewsuth commentedPatch #15 works for me.
Comment #25
dwwSorry folks, I kinda forgot I agreed to co-maintain this. I haven't looked at the issue queue in ages.
Anyway, agreed this is a small, simple fix. #2418369: Internal URL handling (language prefixes, base://, ...) definitely needs to also happen, but that might take a bit longer. I had to fix the tests a bit after this went in for them to pass locally, but otherwise, this looked good. Pushed to 8.x-1.x.
Comment #27
dwwBummer. It looks like this change broke multilingual sites and we're likely to revert it at #3270030: 8.x-1.0-alpha3 breaks images in multi-language sites.. Had this issue had any tests with it, we might be able to find a solution that keeps both features working. But for now, we're going to have to go with fixing bugs at the expense of feature "regressions". It's all still "alpha" at this point. 😅
If someone wants to provide tests that demonstrate the scenario this change was supposed to help, that'd be fantastic. Otherwise, I'm afraid this will have only happened for alpha3, and this feature will be going away in future releases.
Alas,
-Derek
Comment #29
solideogloria commentedMoving to target 2.x
Comment #30
solideogloria commentedI created the fork from the wrong version of the module, so I can't figure out how to get a MR for 2.0.x. Oh well. Here's a patch, since the prior patches don't apply to 2.0.x.
Comment #31
solideogloria commentedThe patch works wonderfully for 2.0.x if you don't have translations.
Comment #32
alexander tallqvist commentedRe-rolled patch for 2.0.0.
Comment #33
solideogloria commentedIt's time to use merge requests instead of patches.
Comment #35
solideogloria commentedComment #37
solideogloria commentedRebasing MR
Comment #40
solideogloria commentedThe prior branch was having trouble rebasing. Created a new branch and updated the fork before making changes.
Comment #41
solideogloria commented