gethugothemes / dot-hugo

Dot - Hugo Documentation Theme
https://gethugothemes.com/products/dot/?utm_source=dot_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
261 stars 148 forks source link

Broken "Home" link when not using multiple languages (regression) #153

Closed AxxL closed 3 years ago

AxxL commented 4 years ago

This issue is a regression from issue https://github.com/themefisher/dot-hugo-documentation-theme/issues/120. With all the changes done in the structure, again: When using the dot theme with only only language, the "Home" links are broken.

You can simply use former merge request and change the file layouts/partials/navigation.html and put in the Link to home. Since I need some text I use the .Site.Params.Hometext variable which I created in config.toml and which especially is a "works for me" solution.

I hope the following diff helps, I unfortuentaly didn't check everything and therefore didn't create a merge request.

$ git diff
diff --git a/config.toml b/config.toml
index 7b2ce42..f026e65 100644
--- a/config.toml
+++ b/config.toml
@@ -10,6 +10,7 @@ logo = "images/logo.png"
 # logo white is for homepage logo, you can use colorful logo too...
 logo_white = ""
 # when logo is empty, it will shown your site title
+hometext = "home"

 # customize color
 primary_color = "#E20074"
diff --git a/themes/dot/layouts/partials/navigation.html b/themes/dot/layouts/partials/navigation.html
index e6c5a8f..bcbc64b 100644
--- a/themes/dot/layouts/partials/navigation.html
+++ b/themes/dot/layouts/partials/navigation.html
@@ -21,6 +21,9 @@

     <div class="collapse navbar-collapse text-center" id="navigation">
       <ul class="navbar-nav ml-auto">
+        <li class="nav-item">
+          <a class="nav-link text-light" href="{{ .Site.BaseURL | relLangURL }}">{{ .Site.Params.Hometext }}</a>
+        </li>
         {{ range site.Menus.main }}
         {{ if .HasChildren }}
         <li class="nav-item dropdown">
tfsomrat commented 4 years ago

Hello @AxxL

I checked it on my localhost, and didn't find any kind of issue like this, can you please share any live URL so I can check it? Thanks

AxxL commented 3 years ago

OK, sorry, "not a bug", I've made some config error and compared the example config.toml with mine again and found this snippet:

[[Languages.de.menu.main]]
name = "Home"
url = "/"
weight = 1

Sorry for this.