Skip to the content
Documentation

ez_urlalias: comparison of v.1 vs v.2

No ratings yet

Versions Compared

Old Version 1

changes.mady.by.user Jérôme Vieilledent

Saved on Nov 03, 2014

compared with

New Version Current

changes.mady.by.user Dominika Kurek

Saved on Jan 29, 2016

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

ez_urlalias is a not a real Twig helper, but a special route name for generating URLs for a location, Location from the given parameters.

...

Working with Location

Linking to other locations Locations is fairly easy and is done with native path() Twig helper (or url() if you want to generate absolute URLs). You just have to pass it the Location object and path() will generate the URLAlias for you.

...

 

Generating a link from a Content ID

Link generation from contentId is available as of 

Status
colour Yellow
title 5.4

 / 

Status
colour Yellow
title 2014.11

.

Code Block
language xml
<a href="{{ path( "ez_urlalias", {"contentId": 456} ) }}">Some link from a contentId</a>

 

Important: Links generated from a Content ID will point to its main location.

Error management

For Location alias setup 301 redirect to Location's current URL when:

  1. alias is history
  2. alias is custom with forward flag true
  3. requested URL is not case-sensitive equal with the one loaded

 

Info
title Under the hood

In the backend, path() uses the Router to generate links.

This makes it also easy to generate links from PHP, via the router service.

Comments

Add a comment

Comments are read by a moderator before they appear.