2017 © Pedro Peláez
 

typo3-cms-extension canonical-url

Makes your typo3 aware of the url it is used on

image

nemo64/canonical-url

Makes your typo3 aware of the url it is used on

  • Friday, July 6, 2018
  • by Nemo641
  • Repository
  • 1 Watchers
  • 0 Stars
  • 91 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Latest Stable Version Total Downloads Monthly Downloads License, (*1)

EXT:canonical_url

This extension adds some canonical url features to your page., (*2)

This extension is based on my Blog Post (in german) in which you can read more about the topic of canonical urls in typo3 and why they aren't as simple as they should be., (*3)

There are also a lot of extension that already bring canonical support with varying implementation quality but in those the canonical url is just one of many features., (*4)

This extension only focuses on how to handle the current page url and you can install this extension and just use the typoscript extensions without any page modifications if you want to have full control., (*5)

I encourage you to use this extension as a dependency in your extension if you need canonical_parameters. This extension won't do anything except for providing the canonical_parameters getText function (and later maybe more ways like view helpers). The integrator will always have to include the static typoscript for this extension to have any effect. It is therefor a save dependency., (*6)

Main features

This extensions adds a TypoScript for you to use. Just add the fittingly named <link rel="canonical"> (canonical_url) static include to your typoscript template and you are all set., (*7)

TypoScript extension data = canonical_parameters

You can use the new getText funktion canonical_parameters to get the query string to the current page. This is different to addQueryString in that it only includes parameters that are relevant for the cache and therefor validated using the cHash Mechanismus., (*8)

Here an example on how to create a link to the current page:, (*9)

lib.currentPageLink = TEXT
lib.currentPageLink {
    value = Current page

    typolink {
        parameter.data = page:uid
        additionalParams.data = canonical_parameters
        useCacheHash = 1
    }
}

And here an example on how to create a breadcrumb where the last entry is the current page:, (*10)

lib.breadcrumb = HMENU
lib.breadcrumb {
    wrap = <nav aria-label="breadcrumb"><ol class="breadcrumb">|</ol></nav>
    special = rootline
    special.range = 1|-1
    includeNotInMenu = 1

    1 = TMENU
    1 {
        NO = 1
        NO.wrapItemAndSub = <li class="breadcrumb-item">|</li>

        CUR < .NO
        CUR.additionalParams.data = canonical_parameters
        CUR.wrapItemAndSub = <li class="breadcrumb-item active" aria-current="page">|</li>
        CUR.stdWrap.data = TSFE:altPageTitle // page:nav_title // page:title
        CUR.doNotLinkIt = 1
    }
}

And here an example on how to implement hreflang:, (*11)

page.headerData {
    99 = TEXT
    99.wrap = <link rel="alternate" hreflang="x-default" href="|">
    99.typolink {
        parameter.data = page:uid
        additionalParams.data = canonical_parameters
        additionalParams.wrap = |&L=0
    }

    100 < .99
    100.wrap = <link rel="alternate" hreflang="en" href="|">
    100.typolink.additionalParams.wrap = |&L=0

    101 < .99
    101.wrap = <link rel="alternate" hreflang="de" href="|">
    101.typolink.additionalParams.wrap = |&L=1
}

The Versions

06/07 2018

dev-master

9999999-dev

Makes your typo3 aware of the url it is used on

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

05/07 2018

v1.0.0

1.0.0.0

Makes your typo3 aware of the url it is used on

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires