A content editor can add a link to an external domain and visitors will reach that external site
User story
Given that I am logged in as a content editor, # or any other role that can edit content
when I use the WYSIWIG to add a link to www.drutopia.org
I want to have a link that goes to http://www.drutopia.org so that the link doesn't break.
Background
Presently, if a content editor on example.org were to add a link to www.drutopia.org
it would go to example.org/www.drutopia.org
which doesn't work too well.
Proposed solution
I dimly thought https://www.drupal.org/project/pathologic could fix situations like this. I'm pretty sure it could make it safe for us to say, use /
to start any relative path, and if your site is (ever) in a subdirectory not at its own domain, then Pathologic can fix that for you. This is more reliable than counting on the path of the content itself not to change (if /about-us
changes to /about/team
then the link to contact
will stop working at /contact
and start breaking at /about/contact
).
This means that if we include Pathologic with basic configuration, we can liberally interpret anything in an href=""
that has a dot in it (href="example.whoswho/that-is-a-real-top-level-domain
) as a domain and turn it into a URL for people. If someone has managed to make a path with a dot in it in Drupal, they will need to link to it as href="/example.whoswho"
.
Remaining work
-
Figure out how to do this, presumably in an input filter using at least one contrib module -
Configure drutopia_site to have all HTML input formats use this -
Add documentation, somewhere, for all people who edit content. It is very unlikely anyone will have difficulty with the more intelligent link interpretation but if they search for "why is my internal link going to a non-existent site?" they should find it.