<!DOCTYPE html> <html lang="en" dir="ltr" itemscope itemtype="http://schema.org/Article" data-r-output-format="print"> <head> <meta charset="utf-8"> <meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0, minimum-scale=1.0"> <meta name="generator" content="Hugo 0.145.0"> <meta name="generator" content="Relearn 7.6.0+4e48cbf22278352557c206b228e98fc9de9d9f88"> <meta name="description" content="What options are available for links and images"> <meta name="author" content="Sören Weber"> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:image" content="https://mcshelby.github.io/hugo-theme-relearn/images/hero.png"> <meta name="twitter:title" content="Linking :: Hugo Relearn Theme"> <meta name="twitter:description" content="What options are available for links and images"> <meta property="og:url" content="https://mcshelby.github.io/hugo-theme-relearn/configuration/content/linking/index.html"> <meta property="og:site_name" content="Hugo Relearn Theme"> <meta property="og:title" content="Linking :: Hugo Relearn Theme"> <meta property="og:description" content="What options are available for links and images"> <meta property="og:locale" content="en"> <meta property="og:type" content="article"> <meta property="article:section" content="Configuration"> <meta property="og:image" content="https://mcshelby.github.io/hugo-theme-relearn/images/hero.png"> <meta itemprop="name" content="Linking :: Hugo Relearn Theme"> <meta itemprop="description" content="What options are available for links and images"> <meta itemprop="wordCount" content="231"> <meta itemprop="image" content="https://mcshelby.github.io/hugo-theme-relearn/images/hero.png"> <meta itemprop="keywords" content="Howto,DisableDefaultRelref,DisableExplicitIndexURLs,EnableLegacyLanguageLinks"> <title>Linking :: Hugo Relearn Theme</title> <link href="https://mcshelby.github.io/hugo-theme-relearn/configuration/content/linking/index.html" rel="alternate" hreflang="x-default"> <link href="https://mcshelby.github.io/hugo-theme-relearn/configuration/content/linking/index.html" rel="alternate" hreflang="en"> <link href="https://mcshelby.github.io/hugo-theme-relearn/pir/configuration/content/linking/index.html" rel="alternate" hreflang="art-x-pir"> <link href="https://mcshelby.github.io/hugo-theme-relearn/configuration/content/linking/index.html" rel="canonical" type="text/html" title="Linking :: Hugo Relearn Theme"> <link href="/hugo-theme-relearn/configuration/content/linking/index.xml" rel="alternate" type="application/rss+xml" title="Linking :: Hugo Relearn Theme"> <link href="/hugo-theme-relearn/images/logo.svg?1743337074" rel="icon" type="image/svg+xml"> <link href="/hugo-theme-relearn/fonts/fontawesome/css/fontawesome-all.min.css?1743337074" rel="stylesheet" media="print" onload="this.media='all';this.onload=null;"><noscript><link href="/hugo-theme-relearn/fonts/fontawesome/css/fontawesome-all.min.css?1743337074" rel="stylesheet"></noscript> <link href="/hugo-theme-relearn/css/perfect-scrollbar/perfect-scrollbar.min.css?1743337074" rel="stylesheet"> <link href="/hugo-theme-relearn/css/theme.min.css?1743337074" rel="stylesheet"> <link href="/hugo-theme-relearn/css/format-print.min.css?1743337074" rel="stylesheet" id="R-format-style"> <link href="/hugo-theme-relearn/css/auto-complete/auto-complete.min.css?1743337074" rel="stylesheet"> <script src="/hugo-theme-relearn/js/auto-complete/auto-complete.min.js?1743337074" defer></script> <script src="/hugo-theme-relearn/js/lunr/lunr.min.js?1743337074" defer></script> <script src="/hugo-theme-relearn/js/lunr/lunr.stemmer.support.min.js?1743337074" defer></script> <script src="/hugo-theme-relearn/js/lunr/lunr.multi.min.js?1743337074" defer></script> <script src="/hugo-theme-relearn/js/lunr/lunr.en.min.js?1743337074" defer></script> <script src="/hugo-theme-relearn/js/search.min.js?1743337074" defer></script> <script> window.relearn = window.relearn || {}; // configuration window.relearn.min = `.min`; window.relearn.path='\/configuration\/content\/linking\/index.html'; window.relearn.relBasePath='..\/..\/..'; window.relearn.relBaseUri='..\/..\/..\/..'; window.relearn.absBaseUri='https:\/\/mcshelby.github.io\/hugo-theme-relearn'; window.relearn.contentLangs=['en']; window.relearn.index_js_url="/hugo-theme-relearn/searchindex.en.js?1743337074"; window.relearn.disableAnchorCopy=false; window.relearn.disableAnchorScrolling=false; window.relearn.disableInlineCopyToClipboard=true; window.relearn.enableBlockCodeWrap=true; // legal window.relearn.getItem = (s,n) => {return s.getItem(n)}; window.relearn.setItem = (s,n,v) => {return s.setItem(n,v)}; window.relearn.removeItem = (s,n) => {return s.removeItem(n)}; // variant stuff window.relearn.themevariants = [ 'relearn-auto', 'relearn-dark', 'relearn-light', 'relearn-bright', 'zen-auto', 'zen-dark', 'zen-light', 'retro-auto', 'neon', 'learn', 'blue', 'green', 'red' ]; window.relearn.customvariantname = "my-custom-variant"; window.relearn.changeVariant = function(variant) { var oldVariant = document.documentElement.dataset.rThemeVariant; window.relearn.setItem(window.localStorage, window.relearn.absBaseUri + "/variant", variant); document.documentElement.dataset.rThemeVariant = variant; if (oldVariant != variant) { document.dispatchEvent( new CustomEvent('themeVariantLoaded', { detail: { variant, oldVariant } }) ); window.relearn.markVariant(); } } window.relearn.markVariant = function() { var variant = window.relearn.getItem(window.localStorage, window.relearn.absBaseUri + "/variant"); document.querySelectorAll(".R-variantswitcher select").forEach((select) => {select.value = variant;}); } window.relearn.initVariant = function() { var variant = window.relearn.getItem(window.localStorage, window.relearn.absBaseUri + "/variant") ?? ""; if( variant == window.relearn.customvariantname ){ }else if( !variant || !window.relearn.themevariants.includes(variant) ){ variant = window.relearn.themevariants[0]; window.relearn.setItem(window.localStorage, window.relearn.absBaseUri + "/variant", variant); } document.documentElement.dataset.rThemeVariant = variant; } window.relearn.initVariant(); window.relearn.markVariant(); // translations window.T_Copy_to_clipboard = `Copy to clipboard`; window.T_Copied_to_clipboard = `Copied to clipboard!`; window.T_Copy_link_to_clipboard = `Copy link to clipboard`; window.T_Link_copied_to_clipboard = `Copied link to clipboard!`; window.T_Reset_view = `Reset view`; window.T_View_reset = `View reset!`; window.T_No_results_found = `No results found for "{0}"`; window.T_N_results_found = `{1} results found for "{0}"`; </script> <script src="/hugo-theme-relearn/js/variant.min.js?1743337074"></script> <style> #R-body img.bg-white { background-color: white; } #R-logo { font-size: 1.875rem; margin-bottom: -.666rem; margin-top: -.666rem; max-width: 100%; width: 14.125rem; } @media only all and (max-width: 59.999rem) { #R-logo { font-size: 1.5625rem; margin-bottom: -.1875rem; margin-top: -.1875rem; } } #R-logo svg { display: inline-block; opacity: .945; vertical-align: middle; width: 29% !important; } @media only all and (max-width: 59.999rem) { #R-logo svg { width: 24.5% !important; } } #R-logo svg * { opacity: .945; } #R-logo .logo-title{ display: inline-block; text-align: left; text-wrap: wrap; overflow-wrap: break-word; vertical-align: middle; width: 4.5em; } </style> </head> <body class="mobile-support print" data-url="/hugo-theme-relearn/configuration/content/linking/index.html"> <div id="R-body" class="default-animation"> <div id="R-body-overlay"></div> <nav id="R-topbar"> <div class="topbar-wrapper"> <div class="topbar-sidebar-divider"></div> <div class="topbar-area topbar-area-start" data-area="start"> <div class="topbar-button topbar-button-sidebar" data-content-empty="disable" data-width-s="show" data-width-m="hide" data-width-l="hide"><button class="topbar-control" onclick="toggleNav()" type="button" title="Menu (CTRL+ALT+n)"><i class="fa-fw fas fa-bars"></i></button> </div> <div class="topbar-button topbar-button-toc" data-content-empty="hide" data-width-s="show" data-width-m="show" data-width-l="show"><button class="topbar-control" onclick="toggleTopbarFlyout(this)" type="button" title="Table of Contents (CTRL+ALT+t)"><i class="fa-fw fas fa-list-alt"></i></button> <div class="topbar-content"> <div class="topbar-content-wrapper"> <nav class="TableOfContents"> <ul> <li><a href="#url-management">URL Management</a></li> <li><a href="#legacy-cross-language-links">Legacy Cross-Language Links</a></li> <li><a href="#patching-the-relref-shortcode">Patching the <code>relref</code> Shortcode</a></li> </ul> </nav> </div> </div> </div> </div> <ol class="topbar-breadcrumbs breadcrumbs highlightable" itemscope itemtype="http://schema.org/BreadcrumbList"> <li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement" class="a11y-only"><a itemprop="item" href="/hugo-theme-relearn/index.html"><span itemprop="name">Hugo Relearn Theme</span></a><meta itemprop="position" content="1"> > </li> <li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement" class=""><a itemprop="item" href="/hugo-theme-relearn/configuration/index.html"><span itemprop="name">Configuration</span></a><meta itemprop="position" content="2"> > </li> <li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement" class=""><a itemprop="item" href="/hugo-theme-relearn/configuration/content/index.html"><span itemprop="name">Content</span></a><meta itemprop="position" content="3"> > </li> <li itemscope itemtype="https://schema.org/ListItem" itemprop="itemListElement" class=""><span itemprop="name">Linking</span><meta itemprop="position" content="4"></li> </ol> <div class="topbar-area topbar-area-end" data-area="end"> <div class="topbar-button topbar-button-edit" data-content-empty="disable" data-width-s="area-more" data-width-m="show" data-width-l="show"><a class="topbar-control" href="https://github.com/McShelby/hugo-theme-relearn/edit/main/docs/content/configuration/content/linking/index.en.md" rel="external" target="_self" title="Edit (CTRL+ALT+w)"><i class="fa-fw fas fa-pen"></i></a> </div> <div class="topbar-button topbar-button-print" data-content-empty="disable" data-width-s="area-more" data-width-m="show" data-width-l="show"><a class="topbar-control" href="/hugo-theme-relearn/configuration/content/linking/index.print.html" title="Print whole chapter (CTRL+ALT+p)"><i class="fa-fw fas fa-print"></i></a> </div> <div class="topbar-button topbar-button-prev" data-content-empty="disable" data-width-s="show" data-width-m="show" data-width-l="show"><a class="topbar-control" href="/hugo-theme-relearn/configuration/content/headings/index.html" title="Headings (🡐)"><i class="fa-fw fas fa-chevron-left"></i></a> </div> <div class="topbar-button topbar-button-next" data-content-empty="disable" data-width-s="show" data-width-m="show" data-width-l="show"><a class="topbar-control" href="/hugo-theme-relearn/configuration/content/hidden/index.html" title="Hidden Pages (🡒)"><i class="fa-fw fas fa-chevron-right"></i></a> </div> <div class="topbar-button topbar-button-more" data-content-empty="hide" data-width-s="show" data-width-m="show" data-width-l="show"><button class="topbar-control" onclick="toggleTopbarFlyout(this)" type="button" title="More"><i class="fa-fw fas fa-ellipsis-v"></i></button> <div class="topbar-content"> <div class="topbar-content-wrapper"> <div class="topbar-area topbar-area-more" data-area="more"> </div> </div> </div> </div> </div> </div> </nav> <div id="R-main-overlay"></div> <main id="R-body-inner" class="highlightable configuration" tabindex="-1"> <div class="flex-block-wrapper"> <article class="default"> <header class="headline"> </header> <h1 id="linking">Linking</h1> <p>Further <a href="/hugo-theme-relearn/authoring/frontmatter/linking/index.html">settings are available</a> to be used in your configuration or front matter.</p> <h2 id="url-management">URL Management</h2> <p><span class="badge cstyle cyan badge-with-title"><span class="badge-title"><i class="fa-fw fas fa-gears"></i></span><span class="badge-content">Option</span></span> By default, the theme adds <code>index.html</code> to page links when <code>uglyURLs=false</code> (Hugo’s default).</p> <p>If you’re only using a web server scenario and dislike this, you can reset to Hugo’s default behavior by settings <code>disableExplicitIndexURLs=true</code>.</p> <p>For the file system scenario, you are not allowed to change this value.</p> <div class="tab-panel" data-tab-group="config-code"> <div class="tab-nav"> <div class="tab-nav-title">hugo.</div> <button data-tab-item="toml" class="tab-nav-button tab-panel-style cstyle initial active" tabindex="-1" onclick="switchTab('config-code','toml')" > <span class="tab-nav-text">toml</span> </button> <button data-tab-item="yaml" class="tab-nav-button tab-panel-style cstyle initial" onclick="switchTab('config-code','yaml')" > <span class="tab-nav-text">yaml</span> </button> <button data-tab-item="json" class="tab-nav-button tab-panel-style cstyle initial" onclick="switchTab('config-code','json')" > <span class="tab-nav-text">json</span> </button> </div> <div class="tab-content-container"> <div data-tab-item="toml" class="tab-content tab-panel-style cstyle initial active"> <div class="tab-content-text"> <div class="highlight wrap-code" dir="auto"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">params</span><span class="p">]</span> </span></span><span class="line"><span class="cl"> <span class="nx">disableExplicitIndexURLs</span> <span class="p">=</span> <span class="kc">true</span></span></span></code></pre></div> </div> </div> <div data-tab-item="yaml" class="tab-content tab-panel-style cstyle initial"> <div class="tab-content-text"> <div class="highlight wrap-code" dir="auto"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">params</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">disableExplicitIndexURLs</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span></span></span></code></pre></div> </div> </div> <div data-tab-item="json" class="tab-content tab-panel-style cstyle initial"> <div class="tab-content-text"> <div class="highlight wrap-code" dir="auto"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"params"</span><span class="p">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"disableExplicitIndexURLs"</span><span class="p">:</span> <span class="kc">true</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div> </div> </div> </div> </div> <h2 id="legacy-cross-language-links">Legacy Cross-Language Links</h2> <p>You can link to pages of different languages by appending the <code>lang</code> query parameter with the language code to the URL, e.g. <code>/my-page?lang=pir</code>.</p> <p>In previous releases of the theme you had to prepend the language code to the URL, e.g. <code>/pir/my-page</code> to achieve this.</p> <p>If you still need the old behavior, you can set <code>enableLegacyLanguageLinks=true</code> in your <code>hugo.toml</code>. Note that this legacy feature may be removed in the future.</p> <h2 id="patching-the-relref-shortcode">Patching the <code>relref</code> Shortcode</h2> <p><span class="badge cstyle cyan badge-with-title"><span class="badge-title"><i class="fa-fw fas fa-gears"></i></span><span class="badge-content">Option</span></span> While the usage of <code>relref</code> is obsolete and discouraged by Hugo for a while, existing installations may still use it.</p> <p>In configurations using a <strong>baseURL</strong> with a <strong>subdirectory</strong> and having <strong>relativeURLs=false</strong> (the default), Hugo’s standard <code>relref</code> implementation is failing.</p> <p>To work around this, you can activate a patched version of the shortcode by setting <code>disableDefaultRelref=true</code>.</p> <div class="tab-panel" data-tab-group="config-code"> <div class="tab-nav"> <div class="tab-nav-title">hugo.</div> <button data-tab-item="toml" class="tab-nav-button tab-panel-style cstyle initial active" tabindex="-1" onclick="switchTab('config-code','toml')" > <span class="tab-nav-text">toml</span> </button> <button data-tab-item="yaml" class="tab-nav-button tab-panel-style cstyle initial" onclick="switchTab('config-code','yaml')" > <span class="tab-nav-text">yaml</span> </button> <button data-tab-item="json" class="tab-nav-button tab-panel-style cstyle initial" onclick="switchTab('config-code','json')" > <span class="tab-nav-text">json</span> </button> </div> <div class="tab-content-container"> <div data-tab-item="toml" class="tab-content tab-panel-style cstyle initial active"> <div class="tab-content-text"> <div class="highlight wrap-code" dir="auto"><pre tabindex="0" class="chroma"><code class="language-toml" data-lang="toml"><span class="line"><span class="cl"><span class="p">[</span><span class="nx">params</span><span class="p">]</span> </span></span><span class="line"><span class="cl"> <span class="nx">disableDefaultRelref</span> <span class="p">=</span> <span class="kc">true</span></span></span></code></pre></div> </div> </div> <div data-tab-item="yaml" class="tab-content tab-panel-style cstyle initial"> <div class="tab-content-text"> <div class="highlight wrap-code" dir="auto"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="nt">params</span><span class="p">:</span><span class="w"> </span></span></span><span class="line"><span class="cl"><span class="w"> </span><span class="nt">disableDefaultRelref</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span></span></span></code></pre></div> </div> </div> <div data-tab-item="json" class="tab-content tab-panel-style cstyle initial"> <div class="tab-content-text"> <div class="highlight wrap-code" dir="auto"><pre tabindex="0" class="chroma"><code class="language-json" data-lang="json"><span class="line"><span class="cl"><span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"params"</span><span class="p">:</span> <span class="p">{</span> </span></span><span class="line"><span class="cl"> <span class="nt">"disableDefaultRelref"</span><span class="p">:</span> <span class="kc">true</span> </span></span><span class="line"><span class="cl"> <span class="p">}</span> </span></span><span class="line"><span class="cl"><span class="p">}</span></span></span></code></pre></div> </div> </div> </div> </div> <footer class="footline"> <div class="R-taxonomy taxonomy-categories cstyle" title="Categories" style="--VARIABLE-TAGS-BG-color: var(--INTERNAL-TAG-BG-color);"> <i class="fa-fw fas fa-layer-group"></i> <ul> <li><a class="term-link" href="/hugo-theme-relearn/categories/howto/index.html">Howto</a></li> </ul> </div> </footer> </article> </div> </main> </div> <script src="/hugo-theme-relearn/js/clipboard/clipboard.min.js?1743337074" defer></script> <script src="/hugo-theme-relearn/js/perfect-scrollbar/perfect-scrollbar.min.js?1743337074" defer></script> <script src="/hugo-theme-relearn/js/theme.min.js?1743337074" defer></script> </body> </html>