docs/_layouts
Sebastiaan van Stijn cafd5a9943
Use full URLs for canonical links
Canonical links are expected to be full URLs, not relative.

For this to work, the Dockerfile had to be updated, because we're stripping
the domain-name from links ("<a href..."), but the script currently also included
"<link rel='canonical' .." tags.

With the change, canonical links are left alone;

These hrefs will be replaced

    echo '<a class=foo href="https://docs.docker.com/foo">hello</a>' | sed -e 's#\(<a[^>]* href="\)https://docs.docker.com/#\1/#g'
    # <a class=foo href="/foo">hello</a>
    echo '<a href="https://docs.docker.com/foo">hello</a>' | sed -e 's#\(<a[^>]* href="\)https://docs.docker.com/#\1/#g'
    # <a href="/foo">hello</a>

But, for example, this one is left alone

    echo '<link rel="canonical" href="https://docs.docker.com/foo/bar" />' | sed -e 's#\(<a[^>]* href="?\)https://docs.docker.com/#\1/#g'
    # <link rel="canonical" href="https://docs.docker.com/foo/bar" />

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-10-12 13:09:32 +02:00
..
archive-redirect.html Add rel="noopener" to external links 2020-10-12 13:09:30 +02:00
docs.html Cleanup whitespace in templates 2020-10-09 01:12:05 +02:00
engine-api.html Use full URLs for canonical links 2020-10-12 13:09:32 +02:00
redirect.html Use full URLs for canonical links 2020-10-12 13:09:32 +02:00