0 users online. Create an account or sign in to join them.Users

Search

Hey there! Do you guys include direct links from backend entries to frontend pages in your projects? For me this has become an essential part of nearly every project I build with Symphony and after initially fiddling around with building the full links directly in the backend (first using Entry URL Field, then with the help of Link Preview) I've now settled with mostly using simple ID-based shortlinks instead.

Meaning I use something like /id/123 in the backend and build a 301-redirect that forwards that shortlink to a full URL like /projects/category/title-of-the-project/.

This is also super-useful if you let your clients include internal links in formatted text content! If you instruct them to only use shortlinks you can always change the structure of your full URLs later – without having to worry about broken links hidden in text content.

And while these kind of shortlinks can easily be built using Link Preview I noticed that this approach can cause a significant rise in pageload-time of publish index views when using complex sections and/or lots of entries. So I decided to build my own tailor-made extension for this technique: Entry Shortlink.

It's basically a stripped down version of Link Preview (Big thanks to Nicolas for all the ideas and code I could borrow from there) that cuts away all the overhead in data-loading and solely relies on the entry ID as dynamic part of the URL – which offers a significant speed boost in the abovementioned scenario :)

Shortlinks : Setting up pages and redirects

And as I've already written it down for the extension's readme – here's a small overview of the additional steps I take to poperly set up pages and redirects for the Shortlink-technique:

  1. Install the Page Headers extension.
  2. Create a page named "Shortlink", give it the url-handle id, attach the url-parameter entry-id and give it the types headers and 301.
  3. Create a datasource for each section that uses shortlinks, name it "Shortlink : Section Name", filter the System ID by the entry-id-parameter, include all elements that are needed for building the final URL and attaching the datasource to the Shortlink page.
  4. Create a utility that builds full target URLs for all entries/sections that use shortlinks.
  5. Insert that URL as a 301-redirect-target into the template of the Shortlink page (as described here).

Hope the extension comes handy for some of you & would love to hear your thoughts and feedback!

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.1
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details