Fix smooth scroll for multi-language setup (#93)
This commit is contained in:
parent
c7f2ad72ea
commit
56c8ba4e43
30 changed files with 94 additions and 43 deletions
50
README.md
50
README.md
|
@ -54,6 +54,22 @@ languageCode: en-us
|
||||||
title: "Toha"
|
title: "Toha"
|
||||||
theme: "toha"
|
theme: "toha"
|
||||||
|
|
||||||
|
# Manage languages
|
||||||
|
# For any more details, you can check the official documentation: https://gohugo.io/content-management/multilingual/
|
||||||
|
languages:
|
||||||
|
en:
|
||||||
|
languageName: English
|
||||||
|
weight: 1
|
||||||
|
fr:
|
||||||
|
languageName: Français
|
||||||
|
weight: 2
|
||||||
|
bn:
|
||||||
|
languageName: বাংলা
|
||||||
|
weight: 3
|
||||||
|
|
||||||
|
# Force a locale to be use, really useful to develop the application ! Should be commented in production, the "weight" should rocks.
|
||||||
|
# DefaultContentLanguage: fr
|
||||||
|
|
||||||
# Allow raw html in markdown file
|
# Allow raw html in markdown file
|
||||||
markup:
|
markup:
|
||||||
goldmark:
|
goldmark:
|
||||||
|
@ -75,12 +91,6 @@ enableEmoji: true
|
||||||
|
|
||||||
# Custom parameters
|
# Custom parameters
|
||||||
params:
|
params:
|
||||||
# Copyright Notice
|
|
||||||
copyright: © 2020 Copyright.
|
|
||||||
|
|
||||||
# Meta description for your site. This will help the search engines to find your site.
|
|
||||||
description: Portfolio and personal blog of Jane Doe.
|
|
||||||
|
|
||||||
# background image of the landing page
|
# background image of the landing page
|
||||||
background: "images/background.jpg"
|
background: "images/background.jpg"
|
||||||
|
|
||||||
|
@ -88,8 +98,9 @@ params:
|
||||||
# transparent navbar and the main logo will be used in the non-transparent navbar.
|
# transparent navbar and the main logo will be used in the non-transparent navbar.
|
||||||
# It will be default to the theme logos if not provided.
|
# It will be default to the theme logos if not provided.
|
||||||
logo:
|
logo:
|
||||||
main: /assets/images/main-logo.png
|
main: assets/images/main-logo.png
|
||||||
inverted: /assets/images/inverted-logo.png
|
inverted: assets/images/inverted-logo.png
|
||||||
|
favicon: assets/images/favicon.png
|
||||||
|
|
||||||
# GitHub repo URL of your site
|
# GitHub repo URL of your site
|
||||||
gitRepo: https://github.com/hossainemruz/toha-example-site
|
gitRepo: https://github.com/hossainemruz/toha-example-site
|
||||||
|
@ -100,33 +111,10 @@ params:
|
||||||
# specify whether you want to show Table of Contents in reading page
|
# specify whether you want to show Table of Contents in reading page
|
||||||
enableTOC: true
|
enableTOC: true
|
||||||
|
|
||||||
# specify the list of custom menus that you want to show in the top navbar.
|
|
||||||
# they will be separated by a divider from the main menus.
|
|
||||||
customMenus:
|
|
||||||
- name: Notes
|
|
||||||
url: https://hossainnotes.netlify.app/docs/example/
|
|
||||||
|
|
||||||
# Provide newsletter configuration. This feature hasn't been implemented yet.
|
# Provide newsletter configuration. This feature hasn't been implemented yet.
|
||||||
# Currently, you can just hide it from the footer.
|
# Currently, you can just hide it from the footer.
|
||||||
newsletter:
|
newsletter:
|
||||||
enable: true
|
enable: true
|
||||||
|
|
||||||
# some information about you
|
|
||||||
author:
|
|
||||||
name: "Jane Doe"
|
|
||||||
nickname: "Jane"
|
|
||||||
image: "images/avatar.png"
|
|
||||||
# greeting message before your name. it will default to "Hi! I am" if not provided
|
|
||||||
greeting: "Hi, I am"
|
|
||||||
# give your some contact information. they will be used in the footer
|
|
||||||
contactInfo:
|
|
||||||
email: "janedoe@example.com"
|
|
||||||
phone: "+0123456789"
|
|
||||||
# a summary of what you do
|
|
||||||
summary:
|
|
||||||
- I am a Developer
|
|
||||||
- I work with Go
|
|
||||||
- I love to work with some fun projects
|
|
||||||
```
|
```
|
||||||
|
|
||||||
You can just copy the content for `config.yaml` files from `theme/toha/exampleSite/config.yaml`.
|
You can just copy the content for `config.yaml` files from `theme/toha/exampleSite/config.yaml`.
|
||||||
|
|
|
@ -15,8 +15,9 @@ languages:
|
||||||
bn:
|
bn:
|
||||||
languageName: বাংলা
|
languageName: বাংলা
|
||||||
weight: 3
|
weight: 3
|
||||||
|
|
||||||
# Force a locale to be use, really useful to develop the application ! Should be commented in production, the "weight" should rocks.
|
# Force a locale to be use, really useful to develop the application ! Should be commented in production, the "weight" should rocks.
|
||||||
#DefaultContentLanguage: fr
|
# DefaultContentLanguage: fr
|
||||||
|
|
||||||
# Allow raw html in markdown file
|
# Allow raw html in markdown file
|
||||||
markup:
|
markup:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: আমার-সম্পর্কে
|
name: আমার-সম্পর্কে
|
||||||
|
id: about
|
||||||
enable: true
|
enable: true
|
||||||
weight: 1
|
weight: 1
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: সাফল্য
|
name: সাফল্য
|
||||||
|
id: achievements
|
||||||
enable: true
|
enable: true
|
||||||
weight: 6
|
weight: 6
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: অভিজ্ঞতা
|
name: অভিজ্ঞতা
|
||||||
|
id: experiences
|
||||||
enable: true
|
enable: true
|
||||||
weight: 3
|
weight: 3
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: প্রোজেক্ট
|
name: প্রোজেক্ট
|
||||||
|
id: projects
|
||||||
enable: true
|
enable: true
|
||||||
weight: 4
|
weight: 4
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: সাম্প্রতিক-পোস্ট
|
name: সাম্প্রতিক-পোস্ট
|
||||||
|
id: recent-posts
|
||||||
enable: true
|
enable: true
|
||||||
weight: 5
|
weight: 5
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: দক্ষতা
|
name: দক্ষতা
|
||||||
|
id: skills
|
||||||
enable: true
|
enable: true
|
||||||
weight: 2
|
weight: 2
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: About
|
name: About
|
||||||
|
id: about
|
||||||
enable: true
|
enable: true
|
||||||
weight: 1
|
weight: 1
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Achievements
|
name: Achievements
|
||||||
|
id: achievements
|
||||||
enable: true
|
enable: true
|
||||||
weight: 6
|
weight: 6
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Experiences
|
name: Experiences
|
||||||
|
id: experiences
|
||||||
enable: true
|
enable: true
|
||||||
weight: 3
|
weight: 3
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Projects
|
name: Projects
|
||||||
|
id: projects
|
||||||
enable: true
|
enable: true
|
||||||
weight: 4
|
weight: 4
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Recent Posts
|
name: Recent Posts
|
||||||
|
id: recent-posts
|
||||||
enable: true
|
enable: true
|
||||||
weight: 5
|
weight: 5
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Skills
|
name: Skills
|
||||||
|
id: skills
|
||||||
enable: true
|
enable: true
|
||||||
weight: 2
|
weight: 2
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: "A propos"
|
name: "A propos"
|
||||||
|
id: about
|
||||||
enable: true
|
enable: true
|
||||||
weight: 1
|
weight: 1
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Realisations
|
name: Realisations
|
||||||
|
id: achievements
|
||||||
enable: true
|
enable: true
|
||||||
weight: 6
|
weight: 6
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Experiences
|
name: Experiences
|
||||||
|
id: experiences
|
||||||
enable: true
|
enable: true
|
||||||
weight: 3
|
weight: 3
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Projets
|
name: Projets
|
||||||
|
id: projects
|
||||||
enable: true
|
enable: true
|
||||||
weight: 4
|
weight: 4
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Posts recents
|
name: Posts recents
|
||||||
|
id: recent-posts
|
||||||
enable: true
|
enable: true
|
||||||
weight: 5
|
weight: 5
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# section information
|
# section information
|
||||||
section:
|
section:
|
||||||
name: Competences
|
name: Competences
|
||||||
|
id: skills
|
||||||
enable: true
|
enable: true
|
||||||
weight: 2
|
weight: 2
|
||||||
showOnNavbar: true
|
showOnNavbar: true
|
||||||
|
|
|
@ -25,9 +25,13 @@
|
||||||
<ul>
|
<ul>
|
||||||
{{- range sort $sections "section.weight" }}
|
{{- range sort $sections "section.weight" }}
|
||||||
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
||||||
<li class="nav-item">
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
<a class="smooth-scroll" href="/#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
|
{{ if .section.id }}
|
||||||
</li>
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="smooth-scroll" href="/#{{ $sectionID }}">{{ .section.name }}</a>
|
||||||
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -36,8 +36,12 @@
|
||||||
{{ if $sections }}
|
{{ if $sections }}
|
||||||
{{ range sort $sections "section.weight" }}
|
{{ range sort $sections "section.weight" }}
|
||||||
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
{{ if and (.section.enable) (.section.showOnNavbar)}}
|
||||||
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#{{ replace (lower .section.name) " " "-" }}">{{ .section.name }}</a>
|
<a class="nav-link" href="#{{ $sectionID }}">{{ .section.name }}</a>
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<div class="container anchor p-lg-5 about-section" id="{{ replace (lower .section.name) " " "-" }}">
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="container anchor p-lg-5 about-section" id="{{ $sectionID }}">
|
||||||
<div class="row pt-sm-2 pt-md-4 align-self-center">
|
<div class="row pt-sm-2 pt-md-4 align-self-center">
|
||||||
<!-- summary -->
|
<!-- summary -->
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<div class="container-fluid anchor pb-5 achievements-section" id="{{ replace (lower .section.name) " " "-" }}">
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="container-fluid anchor pb-5 achievements-section" id="{{ $sectionID }}">
|
||||||
{{ if not (.section.hideTitle) }}
|
{{ if not (.section.hideTitle) }}
|
||||||
<h1 class="text-center">{{ .section.name }}</h1>
|
<h1 class="text-center">{{ .section.name }}</h1>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<div class="container-fluid anchor pb-5 experiences-section" id="{{ replace (lower .section.name) " " "-" }}">
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="container-fluid anchor pb-5 experiences-section" id="{{ $sectionID }}">
|
||||||
{{ if not (.section.hideTitle) }}
|
{{ if not (.section.hideTitle) }}
|
||||||
<h1 class="text-center">{{ .section.name }}</h1>
|
<h1 class="text-center">{{ .section.name }}</h1>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -48,7 +48,11 @@
|
||||||
</ul>
|
</ul>
|
||||||
{{ if $sections }}
|
{{ if $sections }}
|
||||||
{{ range first 1 (where (sort $sections "section.weight") ".section.enable" true) }}
|
{{ range first 1 (where (sort $sections "section.weight") ".section.enable" true) }}
|
||||||
<a href="#{{ replace (lower .section.name) " " "-" }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
<a href="#{{ $sectionID }}"><i class="arrow bounce fa fa-chevron-down"></i></a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<div class="container-fluid anchor pb-5 projects-section" id="{{ replace (lower .section.name) " " "-" }}">
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="container-fluid anchor pb-5 projects-section" id="{{ $sectionID }}">
|
||||||
{{ if not (.section.hideTitle) }}
|
{{ if not (.section.hideTitle) }}
|
||||||
<h1 class="text-center">{{ .section.name }}</h1>
|
<h1 class="text-center">{{ .section.name }}</h1>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<div class="container-fluid anchor pb-5 recent-posts-section" id="{{ replace (lower .section.name) " " "-" }}">
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="container-fluid anchor pb-5 recent-posts-section" id="{{ $sectionID }}">
|
||||||
{{ if not (.section.hideTitle) }}
|
{{ if not (.section.hideTitle) }}
|
||||||
<h1 class="text-center">{{ .section.name }}</h1>
|
<h1 class="text-center">{{ .section.name }}</h1>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
<div class="container-fluid anchor pb-5 skills-section" id="{{ replace (lower .section.name) " " "-" }}">
|
{{ $sectionID := replace (lower .section.name) " " "-" }}
|
||||||
|
{{ if .section.id }}
|
||||||
|
{{ $sectionID = .section.id }}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="container-fluid anchor pb-5 skills-section" id="{{ $sectionID }}">
|
||||||
{{ if not (.section.hideTitle) }}
|
{{ if not (.section.hideTitle) }}
|
||||||
<h1 class="text-center">{{ .section.name }}</h1>
|
<h1 class="text-center">{{ .section.name }}</h1>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -64,6 +64,8 @@ var isMobile = false, isTablet = false, isLaptop = false;
|
||||||
$target.focus(); // Set focus again
|
$target.focus(); // Set focus again
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
// Add hash (#) to URL when done scrolling (default click behavior)
|
||||||
|
window.location.hash = this.hash
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue