Structure URL Alias

Introduction

Structure Url Alias is a module that will create one or more aliases of your Structure Page or Listings. This may handy in times when you need two or more url`s pointing to the same Page.

Structure Url Alias comes by default with a new publish tab, where you can enter your alias url's. By default the url will validated and checked on duplicated uri`s

Documentation versions

Installation

Prerequisites

Make sure your system meets the minimum requirements:

Installation Instructions

Update instructions

Publish Tab

After the installation, there will be a new tab available on the publish area. Here you can enter all your alias urls on each new line.

The module will validate the url by default on valid url. Duplicated aliases are allowed, and will be showed on the overview page.

Control panel overview

How it works

The Structure URL Alias is an extension that will link a different url to an entry. This way a structure url can be loaded from multiple urls without redirecting or changing the alias url.

The image below will show, in a simple way the flow.

Flow

Control panel

In the Control Panel of the module you can overview all your created aliases. From here you can edit the entry.

In the settings tab you can enter your license key, created by devot:ee

The 'Synchronize all alias' button will preform a sync on all aliases and will correct the 'current path' if needed. By default this is handled on saving an entry, but in rare situations you will need this to sync the 'curent path'. (The 'current path' is not used but only showed to the end-user)

Control Panel

Global Variables

Global Varaibles follow the pattern what Structure also does {structure_url_alias:variable:value}

Get the url alias segment from the url. n is the number of the segment.

{structure_url_alias:segment:n}

Get the full url alias path

{structure_url_alias:segment:all}

Get the last url alias segment

{structure_url_alias:segment:last}

Get the uri alias path

{structure_url_alias:alias:uri}

Shows if the page is a alias or a real structure page

{structure_url_alias:alias:url}

Show the entry id which is aliases

{structure_url_alias:alias:entry_id}

Entries Variables

Following variables are available in the {exp:channel:entries} loop.

Tag variables

has_alias

Entry has aliases

{has_alias}

no_alias

Entry has no aliases

{no_alias}

count_alias

Get the total alias count

{count_alias}

alias_date_start

Get the start date for a aliases defined in the publish page

{alias_date_start}

alias_date_end

Get the enddate for a aliases defined in the publish page

{alias_date_end}

alias_uri_n

Get the n (number) alias uri (outside a {aliases} loop)

{alias_uri_n}

alias_uri

Get the alias uri (get allways the first alias) (outside a {aliases} loop)

{alias_uri}

alias_url_n

Get the n (number) alias url

{alias_url_n}

alias_url

Get the alias url (get allways the first alias) (outside a {aliases} loop)

{alias_url}

Tagpair

Below are the variables for inside the {aliases}...{/aliases} tagpair

alias_uri

Get the uri alias (inside the {aliases} loop)

{aliases}
    {alias_uri}
{/aliases}

alias_url

Get the url alias (inside the {aliases} loop)

{aliases}
    {alias_url}
{/aliases}

alias_count

Get the count number for the alias

{aliases}
    {alias_count}
{/aliases}

Hooks

structure_url_alias_save_full_alias_begin

(added in v1.3)
this hook is triggered before saving the aliases from the publish tab.

if ($this->EE->extensions->active_hook('structure_url_alias_save_full_alias_begin') === TRUE)
{
  $this->EE->extensions->call('structure_url_alias_save_full_alias_begin', $paths);
}

structure_url_alias_save_full_alias_end

(added in v1.3)
this hook is triggered after saving the aliases from the publish tab.

if ($this->EE->extensions->active_hook('structure_url_alias_save_full_alias_end') === TRUE)
{
  $this->EE->extensions->call('structure_url_alias_save_full_alias_end', $paths_inserted);
}

structure_url_alias_load_alias

(added in v1.3)
this hook is triggered when the url is a alias and the extension load the correct entry.

if ($this->EE->extensions->active_hook('structure_url_alias_load_alias') === TRUE)
{
  $this->EE->extensions->call('structure_url_alias_load_alias', $alias);
}

structure_url_alias_save_relative_alias_begin

(added in v1.4)
this hook is triggered when the url is a alias and the extension load the correct entry.

if ($this->EE->extensions->active_hook('structure_url_alias_save_relative_alias_begin') === TRUE)
{
  $this->EE->extensions->call('structure_url_alias_save_relative_alias_begin', $paths);
}

structure_url_alias_save_relative_alias_end

(added in v1.4)
this hook is triggered when the url is a alias and the extension load the correct entry.

if ($this->EE->extensions->active_hook('structure_url_alias_save_relative_alias_end') === TRUE)
{
  $this->EE->extensions->call('structure_url_alias_save_relative_alias_end', $paths_inserted);
}

Changelog

3.0.0 (04-12-2017)

2.0.1 (01-12-2017)

2.0.0 (02-12-2016)

1.5.5

1.5.4

1.5.3

1.5.2

1.5.1

1.5

1.4.1

1.4

v1.3.2

1.3.1

1.3

1.2.1

1.2

1.1

1.0