diff options
author | somratpro <abdulmonnafsomrat@gmail.com> | 2021-10-31 08:04:44 +0300 |
---|---|---|
committer | somratpro <abdulmonnafsomrat@gmail.com> | 2021-10-31 08:04:44 +0300 |
commit | 1483fc0277aacc957817ea1e21a19ff812ba1485 (patch) | |
tree | 2ec77aafe1a0914a66cc66e65ca3201b0102e164 | |
parent | 6d65e762ad5dee36201166f3721cc93bd5fb2402 (diff) |
added dropdown functionality
-rw-r--r-- | exampleSite/config.toml | 395 | ||||
-rw-r--r-- | layouts/partials/navigation.html | 120 |
2 files changed, 268 insertions, 247 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 9504d93..9c175d3 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,198 +1,197 @@ -################################# Default configuration ################### -baseURL = "https://examplesite.com" -title = "Meghna" -theme = "meghna-hugo" -themesDir = "../.." -# post pagination -paginate = "6" -# post excerpt -summaryLength = "15" -# disqus short name -disqusShortname = "" # get your shortname form here : https://disqus.com -# disable language -disableLanguages = [] - -############################# Plugins ########################## -# css plugins -[[params.plugins.css]] -link = "plugins/bootstrap/bootstrap.min.css" -[[params.plugins.css]] -link = "plugins/themify-icons/themify-icons.css" -[[params.plugins.css]] -link = "plugins/magnific-popup/magnific-popup.css" -[[params.plugins.css]] -link = "plugins/slick/slick.css" -[[params.plugins.css]] -link = "https://fonts.googleapis.com/css?family=Anaheim|Quattrocento+Sans:400,700&display=swap" - -# js plugins -[[params.plugins.js]] -link = "plugins/jquery/jquery.min.js" -[[params.plugins.js]] -link = "plugins/bootstrap/bootstrap.min.js" -[[params.plugins.js]] -link = "plugins/slick/slick.min.js" -[[params.plugins.js]] -link = "plugins/shuffle/shuffle.min.js" -[[params.plugins.js]] -link = "plugins/magnific-popup/jquery.magnific-popup.min.js" -[[params.plugins.js]] -link = "plugins/lazy-load/lozad.min.js" -[[params.plugins.js]] -link = "plugins/google-map/map.js" - -################### English Navigation ######################## -[[Languages.en.menu.main]] -name = "about" -url = "#about" -weight = 1 - -[[Languages.en.menu.main]] -name = "services" -url = "#services" -weight = 2 - -[[Languages.en.menu.main]] -name = "portfolio" -url = "#portfolio" -weight = 3 - -[[Languages.en.menu.main]] -name = "team" -url = "#team" -weight = 4 - -[[Languages.en.menu.main]] -name = "pricing" -url = "#pricing" -weight = 5 - -[[Languages.en.menu.main]] -name = "blog" -url = "#blog" -weight = 6 - -[[Languages.en.menu.main]] -name = "contact" -url = "#contact" -weight = 7 - -[[Languages.en.menu.main]] -name = "themefisher" -url = "https://themefisher.com/" -weight = 8 - - -################### French Navigation ######################## -[[Languages.fr.menu.main]] -name = "sur" -url = "#about" -weight = 1 - -[[Languages.fr.menu.main]] -name = "un service" -url = "#services" -weight = 2 - -[[Languages.fr.menu.main]] -name = "portefeuille" -url = "#portfolio" -weight = 3 - -[[Languages.fr.menu.main]] -name = "équipe" -url = "#team" -weight = 4 - -[[Languages.fr.menu.main]] -name = "tarification" -url = "#pricing" -weight = 5 - -[[Languages.fr.menu.main]] -name = "blog" -url = "#blog" -weight = 6 - -[[Languages.fr.menu.main]] -name = "contact" -url = "#contact" -weight = 7 - -[[Languages.fr.menu.main]] -name = "themefisher" -url = "https://themefisher.com/" -weight = 8 - -############################# Default Parameters ########################## -[params] -logo = "images/logo.png" -# Meta data -description = "Responsive Multipurpose Parallax Hugo Template" -author = "Themefisher" -# Google Analytics -google_analytics_id = "" # Your ID -# post share -post_share = true - -# preloader -[params.preloader] -enable = false -preloader = "images/logo.png" - -# cookies -[params.cookies] -enable = false -expire_days = 2 - -# google map -[params.map] -enable = false -gmap_api = "https://maps.googleapis.com/maps/api/js?key=AIzaSyBu5nZKbeK-WHQ70oqOWo-_4VmwOwKP9YQ" -map_latitude = "51.5223477" -map_longitude = "-0.1622023" -map_marker = "images/marker.png" - -############################# social icons ########################## -[[params.social]] -icon = "ti-facebook" # themify icon pack : https://themify.me/themify-icons -link = "#" - -[[params.social]] -icon = "ti-twitter-alt" # themify icon pack : https://themify.me/themify-icons -link = "#" - -[[params.social]] -icon = "ti-youtube" # themify icon pack : https://themify.me/themify-icons -link = "#" - -[[params.social]] -icon = "ti-linkedin" # themify icon pack : https://themify.me/themify-icons -link = "#" - -[[params.social]] -icon = "ti-dribbble" # themify icon pack : https://themify.me/themify-icons -link = "#" - -[[params.social]] -icon = "ti-pinterest" # themify icon pack : https://themify.me/themify-icons -link = "#" - - -################################ English Language ######################## -[Languages.en] -languageName = "En" -languageCode = "en-us" -contentDir = "content/english" -weight = 1 -home = "Home" -copyright = "Copyright © 2020 Designed by [Themefisher](https://themefisher.com) & Developed by [Gethugothemes](https://gethugothemes.com)" - -################################ France Language ######################## -[Languages.fr] -languageName = "Fr" -languageCode = "fr-fr" -contentDir = "content/french" -weight = 2 -home = "Accueil" -copyright = "Copyright © 2020 Designed by [Themefisher](https://themefisher.com) & Developed by [Gethugothemes](https://gethugothemes.com)" +################################# Default configuration ###################
+baseURL = "https://examplesite.com"
+title = "Meghna"
+theme = "meghna-hugo"
+# post pagination
+paginate = "6"
+# post excerpt
+summaryLength = "15"
+# disqus short name
+disqusShortname = "" # get your shortname form here : https://disqus.com
+# disable language
+disableLanguages = []
+
+############################# Plugins ##########################
+# css plugins
+[[params.plugins.css]]
+link = "plugins/bootstrap/bootstrap.min.css"
+[[params.plugins.css]]
+link = "plugins/themify-icons/themify-icons.css"
+[[params.plugins.css]]
+link = "plugins/magnific-popup/magnific-popup.css"
+[[params.plugins.css]]
+link = "plugins/slick/slick.css"
+[[params.plugins.css]]
+link = "https://fonts.googleapis.com/css?family=Anaheim|Quattrocento+Sans:400,700&display=swap"
+
+# js plugins
+[[params.plugins.js]]
+link = "plugins/jquery/jquery.min.js"
+[[params.plugins.js]]
+link = "plugins/bootstrap/bootstrap.min.js"
+[[params.plugins.js]]
+link = "plugins/slick/slick.min.js"
+[[params.plugins.js]]
+link = "plugins/shuffle/shuffle.min.js"
+[[params.plugins.js]]
+link = "plugins/magnific-popup/jquery.magnific-popup.min.js"
+[[params.plugins.js]]
+link = "plugins/lazy-load/lozad.min.js"
+[[params.plugins.js]]
+link = "plugins/google-map/map.js"
+
+################### English Navigation ########################
+[[Languages.en.menu.main]]
+name = "about"
+url = "#about"
+weight = 1
+
+[[Languages.en.menu.main]]
+name = "services"
+url = "#services"
+weight = 2
+
+[[Languages.en.menu.main]]
+name = "portfolio"
+url = "#portfolio"
+weight = 3
+
+[[Languages.en.menu.main]]
+name = "team"
+url = "#team"
+weight = 4
+
+[[Languages.en.menu.main]]
+name = "pricing"
+url = "#pricing"
+weight = 5
+
+[[Languages.en.menu.main]]
+name = "blog"
+url = "#blog"
+weight = 6
+
+[[Languages.en.menu.main]]
+name = "contact"
+url = "#contact"
+weight = 7
+
+[[Languages.en.menu.main]]
+name = "themefisher"
+url = "https://themefisher.com/"
+weight = 8
+
+
+################### French Navigation ########################
+[[Languages.fr.menu.main]]
+name = "sur"
+url = "#about"
+weight = 1
+
+[[Languages.fr.menu.main]]
+name = "un service"
+url = "#services"
+weight = 2
+
+[[Languages.fr.menu.main]]
+name = "portefeuille"
+url = "#portfolio"
+weight = 3
+
+[[Languages.fr.menu.main]]
+name = "équipe"
+url = "#team"
+weight = 4
+
+[[Languages.fr.menu.main]]
+name = "tarification"
+url = "#pricing"
+weight = 5
+
+[[Languages.fr.menu.main]]
+name = "blog"
+url = "#blog"
+weight = 6
+
+[[Languages.fr.menu.main]]
+name = "contact"
+url = "#contact"
+weight = 7
+
+[[Languages.fr.menu.main]]
+name = "themefisher"
+url = "https://themefisher.com/"
+weight = 8
+
+############################# Default Parameters ##########################
+[params]
+logo = "images/logo.png"
+# Meta data
+description = "Responsive Multipurpose Parallax Hugo Template"
+author = "Themefisher"
+# Google Analytics
+google_analytics_id = "" # Your ID
+# post share
+post_share = true
+
+# preloader
+[params.preloader]
+enable = false
+preloader = "images/logo.png"
+
+# cookies
+[params.cookies]
+enable = false
+expire_days = 2
+
+# google map
+[params.map]
+enable = false
+gmap_api = "https://maps.googleapis.com/maps/api/js?key=AIzaSyBu5nZKbeK-WHQ70oqOWo-_4VmwOwKP9YQ"
+map_latitude = "51.5223477"
+map_longitude = "-0.1622023"
+map_marker = "images/marker.png"
+
+############################# social icons ##########################
+[[params.social]]
+icon = "ti-facebook" # themify icon pack : https://themify.me/themify-icons
+link = "#"
+
+[[params.social]]
+icon = "ti-twitter-alt" # themify icon pack : https://themify.me/themify-icons
+link = "#"
+
+[[params.social]]
+icon = "ti-youtube" # themify icon pack : https://themify.me/themify-icons
+link = "#"
+
+[[params.social]]
+icon = "ti-linkedin" # themify icon pack : https://themify.me/themify-icons
+link = "#"
+
+[[params.social]]
+icon = "ti-dribbble" # themify icon pack : https://themify.me/themify-icons
+link = "#"
+
+[[params.social]]
+icon = "ti-pinterest" # themify icon pack : https://themify.me/themify-icons
+link = "#"
+
+
+################################ English Language ########################
+[Languages.en]
+languageName = "En"
+languageCode = "en-us"
+contentDir = "content/english"
+weight = 1
+home = "Home"
+copyright = "Copyright © 2020 Designed by [Themefisher](https://themefisher.com) & Developed by [Gethugothemes](https://gethugothemes.com)"
+
+################################ France Language ########################
+[Languages.fr]
+languageName = "Fr"
+languageCode = "fr-fr"
+contentDir = "content/french"
+weight = 2
+home = "Accueil"
+copyright = "Copyright © 2020 Designed by [Themefisher](https://themefisher.com) & Developed by [Gethugothemes](https://gethugothemes.com)"
diff --git a/layouts/partials/navigation.html b/layouts/partials/navigation.html index 5da4846..543ebb0 100644 --- a/layouts/partials/navigation.html +++ b/layouts/partials/navigation.html @@ -1,49 +1,71 @@ -<section class="sticky-top navigation"> - <div class="container"> - <nav class="navbar navbar-expand-lg navbar-dark"> - <a class="navbar-brand p-0" href="{{ .Site.BaseURL | relLangURL }}"> - {{ if site.Params.logo }} - <img class="lozad" data-src="{{ site.Params.logo | absURL }}" alt="{{ .Site.Title }}" height="42"> - {{ else }} - {{ site.Title }} - {{ end }} - </a> - - <button class="navbar-toggler rounded-0" type="button" data-toggle="collapse" data-target="#navigation"> - <span class="navbar-toggler-icon"></span> - </button> - - <div class="collapse navbar-collapse" id="navigation"> - <ul class="navbar-nav ml-auto"> - {{ range site.Menus.main }} - <li class="nav-item"> - <a class="nav-link" {{if findRE `^http` .URL}}target="_blank"{{end}} - href="{{if findRE `^#` .URL}}{{if not $.IsHome}}{{site.BaseURL | relLangURL}}{{end}}{{ .URL }}{{else}}{{.URL | relLangURL}}{{end}}">{{ .Name }}</a> - </li> - {{ end }} - </ul> - <!-- Language List --> - {{- if site.IsMultiLingual }} - <select id="select-language" onchange="location = this.value;"> - {{ $siteLanguages := site.Languages}} - {{ $pageLang := .Page.Lang}} - {{ range .Page.AllTranslations }} - {{ $translation := .}} - {{ range $siteLanguages }} - {{ if eq $translation.Lang .Lang }} - {{ $selected := false }} - {{ if eq $pageLang .Lang}} - <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}" selected>{{ .LanguageName }} - </option> - {{ else }} - <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}">{{ .LanguageName }}</option> - {{ end }} - {{ end }} - {{ end }} - {{ end }} - </select> - {{ end }} - </div> - </nav> - </div> -</section> +<section class="sticky-top navigation">
+ <div class="container">
+ <nav class="navbar navbar-expand-lg navbar-dark">
+ <a class="navbar-brand p-0" href="{{ .Site.BaseURL | relLangURL }}">
+ {{ if site.Params.logo }}
+ <img class="lozad" data-src="{{ site.Params.logo | absURL }}" alt="{{ .Site.Title }}" height="42">
+ {{ else }}
+ {{ site.Title }}
+ {{ end }}
+ </a>
+
+ <button class="navbar-toggler rounded-0" type="button" data-toggle="collapse" data-target="#navigation">
+ <span class="navbar-toggler-icon"></span>
+ </button>
+
+ <div class="collapse navbar-collapse" id="navigation">
+ <ul class="navbar-nav ml-auto">
+ <!-- menu active -->
+ {{ $currentPage := . }}
+ {{ range site.Menus.main }}
+ {{ $menuURL := .URL | absLangURL }}
+ {{ $pageURL:= $currentPage.Permalink | absLangURL }}
+ {{ $active := eq $menuURL $pageURL }}
+ {{ if .HasChildren }}
+ <li class="nav-item dropdown">
+ <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true"
+ aria-expanded="false">
+ {{ .Name }}
+ </a>
+ <div class="dropdown-menu">
+ {{ range .Children }}
+ {{ $childURL := .URL | absLangURL }}
+ {{ $active := eq $childURL $pageURL }}
+ <a class="dropdown-item" {{if findRE `^http` .URL}}target="_blank" rel="noopener" {{end}}
+ href="{{if findRE `^#` .URL}}{{if not $.IsHome}}{{site.BaseURL | relLangURL}}{{end}}{{.URL}}{{else}}{{.URL | relLangURL}}{{end}}">{{ .Name }}</a>
+ {{ end }}
+ </div>
+ </li>
+ {{ else }}
+ <li class="nav-item">
+ <a class="nav-link" {{if findRE `^http` .URL}}target="_blank" rel="noopener" {{end}}
+ href="{{if findRE `^#` .URL}}{{if not $.IsHome}}{{site.BaseURL | relLangURL}}{{end}}{{.URL}}{{else}}{{.URL | relLangURL}}{{end}}">{{.Name}}</a>
+ </li>
+ {{ end }}
+ {{ end }}
+ </ul>
+ <!-- Language List -->
+ {{- if site.IsMultiLingual }}
+ <select id="select-language" onchange="location = this.value;">
+ {{ $siteLanguages := site.Languages}}
+ {{ $pageLang := .Page.Lang}}
+ {{ range .Page.AllTranslations }}
+ {{ $translation := .}}
+ {{ range $siteLanguages }}
+ {{ if eq $translation.Lang .Lang }}
+ {{ $selected := false }}
+ {{ if eq $pageLang .Lang}}
+ <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}" selected>{{ .LanguageName }}
+ </option>
+ {{ else }}
+ <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}">{{ .LanguageName }}</option>
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ {{ end }}
+ </select>
+ {{ end }}
+ </div>
+ </nav>
+ </div>
+</section>
|