CINXE.COM

Multiple sites sharing the same navigation data - support - HUGO

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Multiple sites sharing the same navigation data - support - HUGO</title> <meta name="description" content="Im hoping there is something I can do, but I have a plan if not… Problem: I have multiple sites that are all rendered under a single domain using Azure Front Door… and I want to share the header and footer menu data bet&amp;hellip;"> <meta name="generator" content="Discourse 3.5.0.beta1-dev - https://github.com/discourse/discourse version 2e10fe98a3cb93823b7a2e851c7e12e435434fdd"> <link rel="icon" type="image/png" href="https://canada1.discourse-cdn.com/flex036/uploads/gohugo/optimized/2X/6/66a05218f64425b2fa59ede30c1b4b7dc1fdf5f9_2_32x32.ico"> <link rel="apple-touch-icon" type="image/png" href="https://canada1.discourse-cdn.com/flex036/uploads/gohugo/optimized/2X/c/c2d3414c64e766d814100b32063948e604298a70_2_180x180.png"> <meta name="theme-color" media="all" content="#0a1922"> <meta name="color-scheme" content="light"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, viewport-fit=cover"> <link rel="canonical" href="https://discourse.gohugo.io/t/multiple-sites-sharing-the-same-navigation-data/52483" /> <link rel="search" type="application/opensearchdescription+xml" href="https://discourse.gohugo.io/opensearch.xml" title="HUGO Search"> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/color_definitions_hugo-light_1_3_7422c4612de15eed9913fa272be61741ca2fb638.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" class="light-scheme"/> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/desktop_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="desktop" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/checklist_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="checklist" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-adplugin_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-adplugin" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-ai_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-ai" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-akismet_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-akismet" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-cakeday_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-cakeday" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-details_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-details" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-lazy-videos_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-lazy-videos" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-local-dates_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-local-dates" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-narrative-bot_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-narrative-bot" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-presence_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-presence" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-solved_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-solved" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/footnote_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="footnote" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/hosted-site_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="hosted-site" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/poll_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="poll" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/spoiler-alert_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="spoiler-alert" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/discourse-ai_desktop_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="discourse-ai_desktop" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/poll_desktop_52dfd82b80c36235a1a8df0a72a9870cb3864658.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="poll_desktop" /> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/desktop_theme_2_b0b7ba5ce03d9d7dcecf85fee4c4e3d55590293d.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="2" data-theme-name="custom header links"/> <link href="https://yyz2.discourse-cdn.com/flex036/stylesheets/desktop_theme_3_b0b65929b21d150cf59d2a84d7ec757ad929a847.css?__ws=discourse.gohugo.io" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="3" data-theme-name="hugo light"/> <meta id="data-ga-universal-analytics" data-tracking-code="UA-7131036-7" data-json="{&quot;cookieDomain&quot;:&quot;auto&quot;}" data-auto-link-domains=""> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-7131036-7" nonce="FFlOjhQdSrcISI8t3l3FenobJ"></script> <script defer src="https://canada1.discourse-cdn.com/flex036/assets/google-universal-analytics-v4-9e072ae9f23d2cccab25fd7b2debde9018749ade5240fda6e25d27be6a95ed2e.gz.js" data-discourse-entrypoint="google-universal-analytics-v4" nonce="FFlOjhQdSrcISI8t3l3FenobJ"></script> <link rel="alternate nofollow" type="application/rss+xml" title="RSS feed of &#39;Multiple sites sharing the same navigation data&#39;" href="https://discourse.gohugo.io/t/multiple-sites-sharing-the-same-navigation-data/52483.rss" /> <meta property="og:site_name" content="HUGO" /> <meta property="og:type" content="website" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:image" content="https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/b/b91c8ab3a3c1c8679127cf049b46fa919e9e0e5c.png" /> <meta property="og:image" content="https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/2X/b/b91c8ab3a3c1c8679127cf049b46fa919e9e0e5c.png" /> <meta property="og:url" content="https://discourse.gohugo.io/t/multiple-sites-sharing-the-same-navigation-data/52483" /> <meta name="twitter:url" content="https://discourse.gohugo.io/t/multiple-sites-sharing-the-same-navigation-data/52483" /> <meta property="og:title" content="Multiple sites sharing the same navigation data" /> <meta name="twitter:title" content="Multiple sites sharing the same navigation data" /> <meta property="og:description" content="Im hoping there is something I can do, but I have a plan if not… Problem: I have multiple sites that are all rendered under a single domain using Azure Front Door… and I want to share the header and footer menu data between the sites so that they “look” like they are a single unified story. Right now, the header and footer on the sub-sites are hard coded and need to be manually updated. Example: nkdagility.com is really yellow-pond-042d21b03.5.azurestaticapps.net nkdagility.com/learn/azure-d..." /> <meta name="twitter:description" content="Im hoping there is something I can do, but I have a plan if not… Problem: I have multiple sites that are all rendered under a single domain using Azure Front Door… and I want to share the header and footer menu data between the sites so that they “look” like they are a single unified story. Right now, the header and footer on the sub-sites are hard coded and need to be manually updated. Example: nkdagility.com is really yellow-pond-042d21b03.5.azurestaticapps.net nkdagility.com/learn/azure-d..." /> <meta property="og:article:section" content="support" /> <meta property="og:article:section:color" content="652D90" /> <meta name="twitter:label1" value="Reading time" /> <meta name="twitter:data1" value="1 mins 🕑" /> <meta name="twitter:label2" value="Likes" /> <meta name="twitter:data2" value="4 ❤" /> <meta property="article:published_time" content="2024-11-20T16:29:37+00:00" /> <meta property="og:ignore_canonical" content="true" /> <script type="application/ld+json">{"@context":"http://schema.org","@type":"QAPage","name":"Multiple sites sharing the same navigation data","mainEntity":{"@type":"Question","name":"Multiple sites sharing the same navigation data","text":"Im hoping there is something I can do, but I have a plan if not…\n\nProblem: I have multiple sites that are all rendered under a single domain using Azure Front Door… and I want to share the header and footer menu data between the sites so that they “look” like they are a single unified story. Right n&hellip;","upvoteCount":0,"answerCount":1,"datePublished":"2024-11-20T16:29:37.503Z","author":{"@type":"Person","name":"MrHinsh","url":"https://discourse.gohugo.io/u/MrHinsh"},"acceptedAnswer":{"@type":"Answer","text":"OK, so the content exists on Site A, and you want the footer menus of both Site A and Site B to point to the content on Site A.\n\nTry this:\n\ngit clone --single-branch -b hugo-forum-topic-52483 https://github.com/jmooring/hugo-testing hugo-forum-topic-52483\n\ncd hugo-forum-topic-52483\n\nhugo server\n\nNote &hellip;","upvoteCount":2,"datePublished":"2024-11-21T22:54:42.636Z","url":"https://discourse.gohugo.io/t/multiple-sites-sharing-the-same-navigation-data/52483/11","author":{"@type":"Person","name":"jmooring","url":"https://discourse.gohugo.io/u/jmooring"}}}}</script> </head> <body class="crawler browser-update"> <script defer="" src="https://yyz2.discourse-cdn.com/flex036/theme-javascripts/417061e7eee24be4fb6a457975f0dce96a82d9e6.js?__ws=discourse.gohugo.io" data-theme-id="5" nonce="FFlOjhQdSrcISI8t3l3FenobJ"></script> <header> <a href="/"> HUGO </a> </header> <div id="main-outlet" class="wrap" role="main"> <div id="topic-title"> <h1> <a href="/t/multiple-sites-sharing-the-same-navigation-data/52483">Multiple sites sharing the same navigation data</a> </h1> <div class="topic-category" itemscope itemtype="http://schema.org/BreadcrumbList"> <span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a href="/c/support/34" class="badge-wrapper bullet" itemprop="item"> <span class='badge-category-bg' style='background-color: #652D90'></span> <span class='badge-category clear-badge'> <span class='category-name' itemprop='name'>support</span> </span> </a> <meta itemprop="position" content="1" /> </span> </div> </div> <div itemscope itemtype='http://schema.org/DiscussionForumPosting'> <meta itemprop='headline' content='Multiple sites sharing the same navigation data'> <link itemprop='url' href='https://discourse.gohugo.io/t/multiple-sites-sharing-the-same-navigation-data/52483'> <meta itemprop='datePublished' content='2024-11-20T16:29:37Z'> <meta itemprop='articleSection' content='support'> <meta itemprop='keywords' content=''> <div itemprop='publisher' itemscope itemtype="http://schema.org/Organization"> <meta itemprop='name' content='HUGO'> </div> <div id='post_1' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/MrHinsh'><span itemprop='name'>MrHinsh</span></a> </span> <link itemprop="mainEntityOfPage" href="https://discourse.gohugo.io/t/multiple-sites-sharing-the-same-navigation-data/52483"> <span class="crawler-post-infos"> <time datetime='2024-11-20T16:29:37Z' class='post-time'> November 20, 2024, 4:29pm </time> <meta itemprop='dateModified' content='2024-11-21T07:43:11Z'> <span itemprop='position'>1</span> </span> </div> <div class='post' itemprop='text'> <p>Im hoping there is something I can do, but I have a <code>plan</code> if not…</p> <p>Problem: I have multiple sites that are all rendered under a single domain using Azure Front Door… and I want to share the header and footer menu data between the sites so that they “look” like they are a single unified story. Right now, the header and footer on the sub-sites are hard coded and need to be manually updated.</p> <p>Example:</p> <ul> <li><a href="https://nkdagility.com" rel="noopener nofollow ugc">nkdagility.com</a> is really <a href="https://yellow-pond-042d21b03.5.azurestaticapps.net" rel="noopener nofollow ugc">yellow-pond-042d21b03.5.azurestaticapps.net</a></li> <li><a href="https://nkdagility.com/learn/azure-devops-migration-tools/" rel="noopener nofollow ugc">nkdagility.com/learn/azure-devops-migration-tools</a> is really <a href="https://blue-river-093197403.5.azurestaticapps.net" rel="noopener nofollow ugc">blue-river-093197403.5.azurestaticapps.net</a></li> </ul> <p>They are both separate Azure Static sites that come from different repos.</p> <p>Ask: Id like to have some way to at least share the menu data!</p> <p>Backup Solution: I publish my menu data as <a>https://nkdagility.com/navigation.json</a> and write a header and footer that read it and render the same on every site.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_2' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/jmooring'><span itemprop='name'>jmooring</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T16:34:00Z' class='post-time'> November 20, 2024, 4:34pm </time> <meta itemprop='dateModified' content='2024-11-20T16:34:00Z'> <span itemprop='position'>2</span> </span> </div> <div class='post' itemprop='text'> <p>It seems like a Hugo Module would be a good fit for this.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="1" /> <span class='post-likes'>1 Like</span> </div> </div> <div id='post_3' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/MrHinsh'><span itemprop='name'>MrHinsh</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T16:41:02Z' class='post-time'> November 20, 2024, 4:41pm </time> <meta itemprop='dateModified' content='2024-11-20T16:41:02Z'> <span itemprop='position'>3</span> </span> </div> <div class='post' itemprop='text'> <p>Im not sure how modules help other than to support my backup solution. Are you suggesting that is the way?</p> <p>I was hoping for something slicker <img src="https://emoji.discourse-cdn.com/twitter/wink.png?v=12" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_4' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/jmooring'><span itemprop='name'>jmooring</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T16:43:26Z' class='post-time'> November 20, 2024, 4:43pm </time> <meta itemprop='dateModified' content='2024-11-20T16:43:26Z'> <span itemprop='position'>4</span> </span> </div> <div class='post' itemprop='text'> <p>The module will hold a Hugo configuration file that contains menu entries using Hugo’s standard menu structure.</p> <p>You can test using this example module:<br> <a href="https://github.com/jmooring/hugo-module-content">https://github.com/jmooring/hugo-module-content</a></p> <p>After following the directions in the README to add it to your project, add this to your home page template:</p> <pre><code class="lang-auto">&lt;pre&gt;{{ jsonify (dict "indent" " ") site.Menus.articles }}&lt;/pre&gt; </code></pre> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="1" /> <span class='post-likes'>1 Like</span> </div> </div> <div id='post_5' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/MrHinsh'><span itemprop='name'>MrHinsh</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T16:45:50Z' class='post-time'> November 20, 2024, 4:45pm </time> <meta itemprop='dateModified' content='2024-11-20T16:45:50Z'> <span itemprop='position'>5</span> </span> </div> <div class='post' itemprop='text'> <p>Ahh I see…</p> <p>My menu is stored in the pages and not in the hugo.yaml… but I will think on it…</p> <p>Also: Will the “pageref” work if the page does not exist?</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_6' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/jmooring'><span itemprop='name'>jmooring</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T16:48:03Z' class='post-time'> November 20, 2024, 4:48pm </time> <meta itemprop='dateModified' content='2024-11-20T16:48:03Z'> <span itemprop='position'>6</span> </span> </div> <div class='post' itemprop='text'> <p>Although largely a matter of preference, I find it easier to understand and modify menu structures when the entries are defined in the site config.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_7' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/jmooring'><span itemprop='name'>jmooring</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T16:54:42Z' class='post-time'> November 20, 2024, 4:54pm </time> <meta itemprop='dateModified' content='2024-11-20T16:58:39Z'> <span itemprop='position'>7</span> </span> </div> <div class='post' itemprop='text'> <aside class="quote no-group" data-username="MrHinsh" data-post="5" data-topic="52483"> <div class="title"> <div class="quote-controls"></div> <img loading="lazy" alt="" width="24" height="24" src="https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mrhinsh/48/23018_2.png" class="avatar"> MrHinsh:</div> <blockquote> <p>Will the “pageref” work</p> </blockquote> </aside> <p>With this site config:</p> <pre><code class="lang-auto">[[menus.main]] name = 'Home' pageRef = '/' weight = 10 [[menus.main]] name = 'Does not exist' pageRef = '/does-not-exist' weight = 20 </code></pre> <p>And this template code:</p> <pre><code class="lang-plaintext">{{ with site.Menus.main }} &lt;nav class="menu"&gt; &lt;ul&gt; {{ range . }} {{ if $.IsMenuCurrent .Menu . }} &lt;li class="active"&gt;&lt;a aria-current="page" href="{{ .URL }}"&gt;{{ .Name }}&lt;/a&gt;&lt;/li&gt; {{ else if $.HasMenuCurrent .Menu . }} &lt;li class="ancestor"&gt;&lt;a aria-current="true" href="{{ .URL }}"&gt;{{ .Name }}&lt;/a&gt;&lt;/li&gt; {{ else }} &lt;li&gt;&lt;a href="{{ .URL }}"&gt;{{ .Name }}&lt;/a&gt;&lt;/li&gt; {{ end }} {{ end }} &lt;/ul&gt; &lt;/nav&gt; {{ end }} </code></pre> <p>The menu will be rendered like this:</p> <pre data-code-wrap="html"><code class="lang-html">&lt;nav class="menu"&gt; &lt;ul&gt; &lt;li class="active"&gt;&lt;a aria-current="page" href="/"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=""&gt;Does not exist&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; </code></pre> <p>To avoid rendering an entry when the page doesn’t exist, code defensively. Something like:</p> <pre><code class="lang-plaintext">{{ with site.Menus.main }} &lt;nav class="menu"&gt; &lt;ul&gt; {{ range . }} {{ if .URL }} {{ if $.IsMenuCurrent .Menu . }} &lt;li class="active"&gt;&lt;a aria-current="page" href="{{ .URL }}"&gt;{{ .Name }}&lt;/a&gt;&lt;/li&gt; {{ else if $.HasMenuCurrent .Menu . }} &lt;li class="ancestor"&gt;&lt;a aria-current="true" href="{{ .URL }}"&gt;{{ .Name }}&lt;/a&gt;&lt;/li&gt; {{ else }} &lt;li&gt;&lt;a href="{{ .URL }}"&gt;{{ .Name }}&lt;/a&gt;&lt;/li&gt; {{ end }} {{ end }} {{ end }} &lt;/ul&gt; &lt;/nav&gt; {{ end }} </code></pre> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_8' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/MrHinsh'><span itemprop='name'>MrHinsh</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T18:45:32Z' class='post-time'> November 20, 2024, 6:45pm </time> <meta itemprop='dateModified' content='2024-11-20T18:45:32Z'> <span itemprop='position'>8</span> </span> </div> <div class='post' itemprop='text'> <aside class="quote no-group" data-username="jmooring" data-post="7" data-topic="52483"> <div class="title"> <div class="quote-controls"></div> <img loading="lazy" alt="" width="24" height="24" src="https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/48/4214_2.png" class="avatar"> jmooring:</div> <blockquote> <p><code>URL</code></p> </blockquote> </aside> <p>I dont think that URL will populate unless the page that it references exists on the site that you run the code on.</p> <p>Since the pages are on SiteA and the menu needs to be rendered on SiteB, how will Hugo know what URL/Permalink to use on siteB?</p> <p>(sorry, baby duty and one hand typing)</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_9' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/jmooring'><span itemprop='name'>jmooring</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-20T19:12:16Z' class='post-time'> November 20, 2024, 7:12pm </time> <meta itemprop='dateModified' content='2024-11-20T19:12:16Z'> <span itemprop='position'>9</span> </span> </div> <div class='post' itemprop='text'> <p>I am confused. I assumed you wanted a shared menu structure because both sites have the same content structure.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_10' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/MrHinsh'><span itemprop='name'>MrHinsh</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-21T07:44:18Z' class='post-time'> November 21, 2024, 7:44am </time> <meta itemprop='dateModified' content='2024-11-21T07:44:18Z'> <span itemprop='position'>10</span> </span> </div> <div class='post' itemprop='text'> <p>I dont supose that you have a sugestion for the problem?</p> <p>I want to share the “navigation data”.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_11' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/jmooring'><span itemprop='name'>jmooring</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-21T22:54:42Z' class='post-time'> November 21, 2024, 10:54pm </time> <meta itemprop='dateModified' content='2024-11-22T04:03:34Z'> <span itemprop='position'>11</span> </span> </div> <div class='post' itemprop='text'> <p>OK, so the content exists on Site A, and you want the footer menus of both Site A and Site B to point to the content on Site A.</p> <p>Try this:</p> <pre><code class="lang-plaintext">git clone --single-branch -b hugo-forum-topic-52483 https://github.com/jmooring/hugo-testing hugo-forum-topic-52483 cd hugo-forum-topic-52483 hugo server </code></pre> <p>Note that the rendered menu entries use relative URLs to point to local content.</p> <p>Now stop the server and do this:</p> <pre><code class="lang-plaintext">mv content/capabilities content/xx hugo server </code></pre> <p>Note that the rendered menu entries now use absolute URLs pointing to content on the site specified by <code>parentSiteBaseURL</code> in the module’s <code>params</code> configuration file.</p> <p>This is the footer module:<br> <a href="https://github.com/jmooring/hugo-module-footer">https://github.com/jmooring/hugo-module-footer</a></p> <p>Add the footer module to both sites with this in their respective site configuration files:</p> <pre><code class="lang-plaintext">[[module.imports]] path = 'github.com/jmooring/hugo-module-footer' </code></pre> <p>Using the <code>pageRef</code> menu property in the menu configuration enables the <code>.HasMenuCurrent</code> and <code>.IsMenuCurrent</code> methods to work as intended, which is good for both usability and accessibility.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="2" /> <span class='post-likes'>2 Likes</span> </div> <div class='crawler-linkback-list' itemscope itemtype='http://schema.org/ItemList'> <div itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <a itemprop='url' href="https://discourse.gohugo.io/t/pageref-link-doesnt-render-in-the-template/52809/2">Pageref link doesn&#39;t render in the template</a> <meta itemprop='position' content='2'> </div> </div> </div> <div id='post_12' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" rel='nofollow' href='https://discourse.gohugo.io/u/system'><span itemprop='name'>system</span></a> Closed </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-24T09:16:39Z' class='post-time'> November 24, 2024, 9:16am </time> <meta itemprop='dateModified' content='2024-11-24T09:16:39Z'> <span itemprop='position'>12</span> </span> </div> <div class='post' itemprop='text'> <p>This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> </div> <div id="related-topics" class="more-topics__list " role="complementary" aria-labelledby="related-topics-title"> <h3 id="related-topics-title" class="more-topics__list-title"> Related topics </h3> <div class="topic-list-container" itemscope itemtype='http://schema.org/ItemList'> <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'> <table class='topic-list'> <thead> <tr> <th>Topic</th> <th></th> <th class="replies">Replies</th> <th class="views">Views</th> <th>Activity</th> </tr> </thead> <tbody> <tr class="topic-list-item" id="topic-list-item-28928"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='1'> <span class="link-top-line"> <a itemprop='url' href='https://discourse.gohugo.io/t/is-there-a-way-to-create-a-consistent-menu-across-multiple-sites/28928' class='title raw-link raw-topic-link'>Is there a way to create a consistent menu across multiple sites?</a> </span> <div class="link-bottom-line"> <a href='/c/support/34' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #652D90'></span> <span class='badge-category clear-badge'> <span class='category-name'>support</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>12</span> </td> <td class="views"> <span class='views' title='views'>1200</span> </td> <td> October 29, 2020 </td> </tr> <tr class="topic-list-item" id="topic-list-item-9247"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='2'> <span class="link-top-line"> <a itemprop='url' href='https://discourse.gohugo.io/t/merging-two-sites/9247' class='title raw-link raw-topic-link'>Merging two sites</a> </span> <div class="link-bottom-line"> <a href='/c/support/34' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #652D90'></span> <span class='badge-category clear-badge'> <span class='category-name'>support</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>2</span> </td> <td class="views"> <span class='views' title='views'>551</span> </td> <td> November 16, 2017 </td> </tr> <tr class="topic-list-item" id="topic-list-item-32223"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='3'> <span class="link-top-line"> <a itemprop='url' href='https://discourse.gohugo.io/t/shared-partials-in-a-multi-site-multi-lingual-setup/32223' class='title raw-link raw-topic-link'>Shared partials in a multi site multi lingual setup</a> </span> <div class="link-bottom-line"> <a href='/c/support/34' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #652D90'></span> <span class='badge-category clear-badge'> <span class='category-name'>support</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>2</span> </td> <td class="views"> <span class='views' title='views'>379</span> </td> <td> April 7, 2021 </td> </tr> <tr class="topic-list-item" id="topic-list-item-24589"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='4'> <span class="link-top-line"> <a itemprop='url' href='https://discourse.gohugo.io/t/shared-content-between-multiple-sites/24589' class='title raw-link raw-topic-link'>Shared content between multiple sites</a> </span> <div class="link-bottom-line"> <a href='/c/support/34' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #652D90'></span> <span class='badge-category clear-badge'> <span class='category-name'>support</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>6</span> </td> <td class="views"> <span class='views' title='views'>1001</span> </td> <td> April 12, 2020 </td> </tr> <tr class="topic-list-item" id="topic-list-item-5536"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='5'> <span class="link-top-line"> <a itemprop='url' href='https://discourse.gohugo.io/t/site-with-different-lists-of-sections/5536' class='title raw-link raw-topic-link'>Site with different lists of sections</a> </span> <div class="link-bottom-line"> <a href='/c/support/34' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #652D90'></span> <span class='badge-category clear-badge'> <span class='category-name'>support</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>2</span> </td> <td class="views"> <span class='views' title='views'>610</span> </td> <td> February 21, 2017 </td> </tr> </tbody> </table> </div> </div> </div> <footer class="container wrap"> <nav class='crawler-nav'> <ul> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/' itemprop="url">Home </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/categories' itemprop="url">Categories </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/guidelines' itemprop="url">Guidelines </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/tos' itemprop="url">Terms of Service </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/privacy' itemprop="url">Privacy Policy </a> </span> </li> </ul> </nav> <p class='powered-by-link'>Powered by <a href="https://www.discourse.org">Discourse</a>, best viewed with JavaScript enabled</p> </footer> <div class="buorg"><div>Unfortunately, <a href="https://www.discourse.org/faq/#browser">your browser is unsupported</a>. Please <a href="https://browsehappy.com">switch to a supported browser</a> to view rich content, log in and reply.</div></div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10