Jump to content

Relative Links in Anchors


Recommended Posts

Not sure if this should be suggested here or as a plugin for the text editor, but relative links back to sites on the same community should be possible. There are a few ways I can see doing this:

  1. Naked URIs. A link to /forum should be expanded to https://www.example.com/forum . Currently, this expands to https://%2Fforum.
  2. Use a replacement symbol. Razor (C#'s web rendering engine) uses ~, so a link to ~/forum should be expanded to https://www.example.com/forum. We could use other symbols too, but this comes with the benefit of familiarity.
  3. UI change, allowing us to select between an internal and external link. This could get infinitely more complex, either allowing naked URIs as suggested in #1 or having us explicitly select a page to link to, such as how the Menu Builder in the ACP works (though I assume most people are probably going to be linking between forum threads or to blog posts or the like, so it'll have to include those).

I am most in favor of #2 myself. I imagine there would need to be an editor change so as not to prepend http:// to the front of links which use the replacement symbol, as well as not encoding the replacement symbol, but we'd need some help from the Invision Framework itself, finding and replacing instances of the replacement symbol with the canonical link. This should be cached whenever the post is saved, but allow for converting back if the content is ever edited.

The reason behind this change is for portability:

  1. Admins change the domain name of the site, such as for rebranding purposes. Updating content can be a painful chore.
  2. Porting content. In some cases, I like to stage content on my dev instance before porting to production, and having to manually scroll through documents to find where I linked to other things can be kind of annoying.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...