Relative Links in Link Fields on Multisites

Created on 16 June 2020, about 4 years ago
Updated 8 March 2024, 6 months ago

Problem/Motivation

In a multisite that uses subdirectories, the link field will change a correctly-formed relative link into something incorrect. For example, if I'm in a site called example.com/subsite and I create a link in a link field to the URL /subsite/node/1 this URL will render as /subsite/subsite/node/1. The only way to get a working relative link is to omit the site name when forming the relative URL (/node/1).

This is different behavior than what happens in a CKEditor text field. In that field, a relative URL works as intended without the additional site name being appended. With this contrasting behavior, it's difficult to teach an end-user how to properly form a relative URL when it changes based on the input method.

Steps to reproduce:
- Create a multisite that uses subdirectories for each site
- Enable the link module
- Create a content type that includes a link field
- Create a relative link within that link field that references a page in the multisite directory

Proposed resolution

If a link is relative and contains the site name after the initial /, don't prepend the site name.

πŸ› Bug report
Status

Closed: duplicate

Version

11.0 πŸ”₯

Component
FieldΒ  β†’

Last updated 1 day ago

Created by

πŸ‡ΊπŸ‡ΈUnited States johns996 Marquette, MI

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024