PHP code example of nemo64 / canonical-url

1. Go to this page and download the library: Download nemo64/canonical-url library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nemo64 / canonical-url example snippets


lib.currentPageLink = TEXT
lib.currentPageLink {
    value = Current page
    
    typolink {
        parameter.data = page:uid
        additionalParams.data = canonical_parameters
        useCacheHash = 1
    }
}

lib.breadcrumb = HMENU
lib.breadcrumb {
    wrap = <nav aria-label="breadcrumb"><ol class="breadcrumb">|</ol></nav>
    special = rootline
    special.range = 1|-1
     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
    }
}

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
}