Coder Social home page Coder Social logo

Comments (3)

shaform avatar shaform commented on June 8, 2024

Is mobile-menu supposed to support drop down menu?

I am trying to add this feature to my site as well. My current progress:

+++ b/layouts/partials/header.html
@@ -38,5 +38,18 @@
 
       </li>
     {{ end }}
+    {{ if gt (len .Site.Home.AllTranslations) 1 }}
+      <li class="menu-item">
+        <!-- drop down navigation MENU -->
+        <a class="menu-item-link menu-parent" href="{{ .URL | absLangURL | safeURL }}">{{ i18n "language" }}</a>
+        <ul class="submenu">
+          {{ range .Site.Home.AllTranslations }}
+            <li>
+              <a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
+            </li>
+          {{ end }}
+        </ul>
+      </li>
+    {{ end }}
   </ul>
 </nav>
+++ b/layouts/partials/slideout.html
@@ -23,5 +23,17 @@
         </a>
       </li>
     {{- end }}
+    {{ if gt (len .Site.Home.AllTranslations) 1 }}
+      <li class="mobile-menu-item">
+        {{ i18n "language" }}
+        <ul class="submenu">
+          {{ range .Site.Home.AllTranslations }}
+            <li>
+              <a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
+            </li>
+          {{ end }}
+        </ul>
+      </li>
+    {{ end }}
+++ b/i18n/en.yaml
@@ -95,3 +95,7 @@
 
 - id: read_fr
   translation: Lire en français
+
+- id: language
+  translation: Language

from hugo-theme-jane.

xianmin avatar xianmin commented on June 8, 2024

@shaform Yes, mobile-menu should support drop down menu. I will do this next step.

Your progress looks good! But I have a little doubt about "how to display language menu better".
Maybe like this site: https://www.duolingo.com/ ? I am not sure.

Most users just use two languages. They can add a language link to the menu easily.

So, my point is, it's better add an option to show available translations in the menu.

Thanks for your progress. Welcome to PR! 😄

from hugo-theme-jane.

xianmin avatar xianmin commented on June 8, 2024

Thanks for @shaform ! Now, hugo-theme-jane could show list of languages in the menu.

To enable this feature, you need add an option showMenuLanguageChooser = true to your site config file.

from hugo-theme-jane.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.