MAKENTNU / web

The website of the student organization MAKE NTNU, built with Django.
https://makentnu.no
MIT License
9 stars 5 forks source link

Replace absolute URLs in CKEditor text fields with relative ones #538

Open ddabble opened 2 years ago

ddabble commented 2 years ago

[Originally created on the "Dev-Web" Trello board, by @ddabble on November 2, 2020]

When saving articles, events, content boxes, etc., the CKEditor text (content) field should be parsed for <a> tags with absolute URLs whose hostname parts are equal to the request's URL, and the hostname part should be removed, leaving only a relative URL (starting with /) - also known as the path part. It should also be taken into consideration whether the path part of the request's URL starts with a language code (like /en/), and if so, the relative URLs should be prefixed with that language code (if they're not already).