diff options
author | Vicky <vicky@vickylai.com> | 2018-07-26 22:53:56 +0300 |
---|---|---|
committer | Vicky <vicky@vickylai.com> | 2018-07-26 22:53:56 +0300 |
commit | a6f92dcc262bd37cd305f92e82a3af85d62bb392 (patch) | |
tree | e50ea4fac9a8bdb1680aa860fd02db59e5f4e5bb /layouts | |
parent | 58804859f03fca978f60b2f32d5c43d6841b282a (diff) | |
parent | c1a279a871edf6a3a6811d782681d07e9b466dd7 (diff) |
Merge branch 'next_gen' of https://github.com/Hanzei/hugo-theme-introduction into Hanzei-next_gen
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/list.html | 5 | ||||
-rw-r--r-- | layouts/_default/taxonomy.html | 9 | ||||
-rw-r--r-- | layouts/_default/terms.html | 9 | ||||
-rw-r--r-- | layouts/blog/list.html | 8 | ||||
-rw-r--r-- | layouts/blog/single.html | 24 | ||||
-rw-r--r-- | layouts/index.html | 68 | ||||
-rw-r--r-- | layouts/partials/blog/li.html | 2 | ||||
-rw-r--r-- | layouts/partials/css/owlCarousel.html | 4 | ||||
-rw-r--r-- | layouts/partials/footer/scripts.html | 11 | ||||
-rw-r--r-- | layouts/partials/head/css.html | 14 | ||||
-rw-r--r-- | layouts/partials/head/favicons.html | 5 | ||||
-rw-r--r-- | layouts/partials/head/openGraph.html | 6 | ||||
-rw-r--r-- | layouts/partials/home/blog.html | 14 | ||||
-rw-r--r-- | layouts/partials/home/projects.html | 35 | ||||
-rw-r--r-- | layouts/partials/js/owlCarousel.html | 5 | ||||
-rw-r--r-- | layouts/partials/nav.html | 60 | ||||
-rw-r--r-- | layouts/partials/top-icon-with-hr.html | 4 | ||||
-rw-r--r-- | layouts/projects/list.html | 11 | ||||
-rw-r--r-- | layouts/projects/single.html | 19 |
19 files changed, 170 insertions, 143 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index f102ef5..d7d6065 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -2,12 +2,11 @@ <div class="container markdown top-pad"> {{ .Content }} </div> - <!-- Begin container --> <div class="container"> <ul> - {{ range .Pages.ByPublishDate }} + {{ range .Pages.ByPublishDate.Reverse }} <li> - <a href="{{.Permalink}}">{{.Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }} | {{.Title}}</a> + <a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title }}</a> </li> {{ end }} </ul> diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html index 786676b..92e1492 100644 --- a/layouts/_default/taxonomy.html +++ b/layouts/_default/taxonomy.html @@ -1,16 +1,13 @@ {{ define "title" }} - <h1 class="bold-title is-1">Tagged "{{ lower .Title }}"</h1> + <h1 class="bold-title is-1">{{ .Data.Singular | humanize }}: {{ lower .Title }}</h1> {{ end }} {{ define "main" }} <div class="container"> - <article> - {{ .Content }} - </article> <ul> - {{ range .Pages.ByPublishDate }} + {{ range .Pages.ByPublishDate.Reverse }} <li> - <a href="{{.Permalink}}">{{.Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }} | {{.Title}}</a> + <a href="{{ .Permalink }}">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ .Title }}</a> </li> {{ end }} </ul> diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index 9a9a796..08760a0 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -1,12 +1,9 @@ {{ define "main" }} <div class="container"> - <article> - {{ .Content }} - </article> <div class="section tags-list"> - {{ range $name, $taxonomy := .Site.Taxonomies.tags }} - <a class="tag-cloud" href="{{"tags/" | relLangURL }}{{ $name | urlize }}">{{ lower $name }} ({{ len $taxonomy }})</a> - {{ end }} + {{- range $key, $value:= .Data.Terms -}} + <a class="tag-cloud" href="{{ "/" | absLangURL }}{{ $.Data.Plural | urlize }}/{{ $key | urlize }}">{{ $key }} ({{ $value.Count }})</a> + {{- end -}} </div> </div> {{ end }} diff --git a/layouts/blog/list.html b/layouts/blog/list.html index eede8cc..c2c6583 100644 --- a/layouts/blog/list.html +++ b/layouts/blog/list.html @@ -3,19 +3,19 @@ {{ .Content }} </div> <div class="container"> - {{ if .Site.Params.showLatest }} + {{ if .Site.Params.home.showLatest | default true }} <h2 class="title is-2 top-pad">{{ i18n "index_blog_latestPosts" . }}</h2> {{ range first 1 .Pages.ByPublishDate.Reverse }} - <div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }} + <div class="summary">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} <h3 class="title is-3 strong-post-title"> - <a href="{{ .RelPermalink }}"> + <a href="{{ .Permalink }}"> {{ .Title }} </a> </h3> <div class="markdown"> {{ .Summary }} {{ if .Truncated }} - <a href="{{ .RelPermalink }}">{{ i18n "index_blog_readMore" . }}</a> + <a href="{{ .Permalink }}">{{ i18n "index_blog_readMore" . }}</a> {{ end }} </div> </div> diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 64c6666..fcbe513 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -1,5 +1,7 @@ {{ define "title" }} - <h1 class="bold-title is-1">{{ (.Site.GetPage "section" "blog").Title }}</h1> +{{ with .Site.GetPage "/blog" }} + <h1 class="bold-title is-1">{{ .Title }}</h1> +{{ end }} {{ end }} {{ define "main" }} @@ -8,31 +10,31 @@ <a href="{{ .Permalink }}">{{ .Title }}</a> </h2> <div class="post-data"> - {{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }} | + {{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} | {{ i18n "blog_readingTime" .ReadingTime }} </div> - {{ if .Site.Params.shareButtons }} + {{ if or .Site.Params.share.twitter .Site.Params.share.facebook .Site.Params.share.pinterest .Site.Params.share.googlePlus }} <div class="blog-share"> {{ i18n "blog_shareThis" . }}: - {{ if .Site.Params.shareTwitter }} + {{ if .Site.Params.share.twitter }} <a class="twitter-share-button" href="https://twitter.com/intent/tweet?text=Read%20{{ .Title }}%20{{ .Permalink }}" onclick="window.open(this.href, 'twitter-share', 'width=550,height=235');return false;"> <i class="fab fa-twitter"></i> <span class="hidden">Twitter</span> </a> {{ end }} - {{ if .Site.Params.shareFacebook }} + {{ if .Site.Params.share.facebook }} <a class="icon-facebook" href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" onclick="window.open(this.href, 'facebook-share','width=580,height=296');return false;"> <i class="fab fa-facebook-f"></i> <span class="hidden">Facebook</span> </a> {{ end }} - {{ if .Site.Params.sharePinterest }} + {{ if .Site.Params.share.pinterest }} <a class="icon-pinterest" href="http://pinterest.com/pin/create/button/?url={{ .Permalink }}{{ if .Params.pinterestMedia }}&media={{ .Site.BaseURL }}{{ .Params.pinterestMedia }}{{ end }}&description={{ .Title | safeHTML}}" onclick="window.open(this.href, 'pinterest-share','width=580,height=296');return false;"> <i class="fab fa-pinterest-p"></i> <span class="hidden">Pinterest</span> </a> {{ end }} - {{ if .Site.Params.shareGooglePlus }} + {{ if .Site.Params.share.googlePlus }} <a class="icon-google-plus" href="https://plus.google.com/share?url={{ .Permalink }}" onclick="window.open(this.href, 'google-plus-share', 'width=490,height=530');return false;"> <i class="fab fa-google-plus-g"></i> <span class="hidden">Google+</span> @@ -40,6 +42,14 @@ {{ end }} </div> {{ end }} + {{ if .Params.tags }} + <p> + Tag{{ if gt (len .Params.tags) 1 }}s{{ end }}: + {{ range $index, $tag := .Params.tags }} + {{ if gt $index 0 }}, {{ end }}<a href="{{ "/tags/" | absLangURL }}{{ . | urlize }}">{{ . }}</a> + {{ end }} + </p> + {{ end }} </div> <!-- Begin blog post content --> <div class="container markdown top-pad"> diff --git a/layouts/index.html b/layouts/index.html index e789c89..e192241 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -5,20 +5,22 @@ {{ partial "head/openGraph.html" . }} {{ partial "head/favicons.html" . }} {{ partial "head/css.html" . }} + {{ partial "css/owlCarousel.html" . }} </head> <body> <div id="top"> - <div class="hero is-{{ .Site.Params.introHeight | default "fullheight" }}"> + {{ with .Site.GetPage "/home" }} + <div class="hero is-{{ .Site.Params.home.introHeight | default "large" }}"> <!-- Super sweet Hero body title --> <div class="hero-body"> <div class="container has-text-centered"> <!-- Title and tagline --> <h1 class="bold-title {{ if .Site.Params.fadeIn | default true }}fade-in one{{ end }}"> - {{ .Site.Params.firstName | default "Introduction" }}. + {{ .Title }} </h1> - <h3 class="subtitle is-3 {{ if .Site.Params.fadeIn | default true }}fade-in two{{ end }}"> - {{ .Site.Params.tagLine }} - </h3> + <div class="subtitle is-3 {{ if .Site.Params.fadeIn | default true }}fade-in two{{ end }}"> + {{ .Content }} + </div> <!-- End title and tagline --> <!-- Some social icons --> <div class=" {{ if .Site.Params.fadeIn | default true }}fade-in three{{ end }}"> @@ -29,50 +31,64 @@ </div> <!-- Hero body title end --> </div> + {{ end }} + <!-- Done with Hero --> - <!-- Everything below fades in three! --> - <div class="section no-padding-top {{ if .Site.Params.fadeIn | default true }}fade-in three{{ end }}"> + <div class="{{ if .Site.Params.fadeIn | default true }}fade-in three{{ end }}"> <!-- Tell them all about it! --> {{ partial "nav.html" . }} - {{ with .Site.GetPage "page" "about" }} + + {{ with .Site.GetPage "/home" }} + {{ $home := . }} + {{ range sort (.Resources.ByType "page") "Params.weight" }} + {{ if ne .Name "contact.md" }} + <!-- Range through all sections in /home execept contact.md --> <div class="section" id="{{ .File.TranslationBaseName }}"> <div class="container"> <h2 class="title is-2 has-text-centered">{{ .Title }}</h2> - <div class="columns"><!-- Avatar and about.md side by side except mobile --> - {{ if .Site.Params.avatar }} + {{ if .Params.Image }} + <div class="columns"> <div class="column is-one-third has-text-centered"> - <img class="img-responsive avatar" src="{{ .Site.Params.avatar | relURL }}" alt="{{ i18n "index_avatarAlt" . }}"> + {{ with $home.Resources.GetMatch .Params.Image }} + {{ with .Resize "320x" }} + <img class="img-responsive avatar" src="{{ .Permalink }}" alt="{{ .Name }}"> + {{ end }} + {{ end }} </div> - {{ end }} - <div class="column markdown"> - {{.Content}} + <div class="markdown column"> + {{ .Content }} </div> </div> + {{ else }} + <div class="markdown has-text-centered"> + {{ .Content }} + </div> + {{ end }} </div> <!-- End About container--> {{ partial "top-icon.html" . }} </div> <div class="container"><hr></div> - <!-- End About section --> + {{ end }} {{ end }} <!-- Now for some cool projects --> {{ partial "home/projects.html" . }} <!-- Let's show some blog posts --> {{ partial "home/blog.html" . }} <!-- Let's chat, shall we? --> - {{ with .Site.GetPage "page" "contact" }} + {{ with .Resources.GetMatch "contact.md" }} <div class="section" id="{{ .File.TranslationBaseName }}"> <div class="container has-text-centered"> <h2 class="title is-2">{{ .Title }}</h2> <div class="markdown"> - {{.Content}} + {{ .Content }} </div> - {{ if .Site.Params.localTime }} + {{ if .Site.Params.home.localTime }} <p>{{ i18n "index_currentTime" . }} <span id='time'></span>.</p> {{ end }} - {{ if .Site.Params.email }} + {{ with .Site.Params.email }} <h3 class="subtitle is-3 has-text-centered top-pad"> - <a href="mailto:{{ .Site.Params.email }}">{{ .Site.Params.email }}</a> + <a href="mailto:{{ . }}">{{ . }}</a> </h3> {{ end }} {{ partial "home/social.html" . }} @@ -83,10 +99,22 @@ <div class="container"><hr></div> {{ end }} <!-- End Contact section --> + {{ end }} + {{ partial "footer/text.html" . }} </div> </div> <!-- End of fade in three section --> {{ partial "footer/scripts.html" . }} + {{ partial "js/owlCarousel.html" . }} + + {{ if .Site.Params.home.localTime }} + {{ $momentjs := resources.Get "vendor/momentjs/moment.min.js" }} + {{ $momentTimezone := resources.Get "vendor/momentjs/moment-timezone.min.js" }} + {{ $momentTimezoneWithData := resources.Get "vendor/momentjs/moment-timezone-with-data-2012-2022.min.js" }} + {{ $initMomentjs := resources.Get "js/initMoment.js" | resources.ExecuteAsTemplate "js/initMoment.tmp.js" . }} + {{ $bundleMoment := slice $momentjs $momentTimezone $momentTimezoneWithData $initMomentjs | resources.Concat "/js/bundleMoment.js" | fingerprint }} + <script src="{{ $bundleMoment.Permalink }}" integrity="{{ $bundleMoment.Data.Integrity }}"></script> + {{ end }} </body> </html> diff --git a/layouts/partials/blog/li.html b/layouts/partials/blog/li.html index 9a79283..1f13118 100644 --- a/layouts/partials/blog/li.html +++ b/layouts/partials/blog/li.html @@ -1,5 +1,5 @@ {{ range .Pages.ByPublishDate.Reverse }} <li class="post-item"> - <span><a href="{{ .Permalink }}">{{ .Title }}</a></span> - <span>{{ .Date.Format (.Site.Params.dateform | default "Jan 02, 2006") }}</span> + <span><a href="{{ .Permalink }}">{{ .Title }}</a></span> - <span>{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }}</span> </li> {{ end }} diff --git a/layouts/partials/css/owlCarousel.html b/layouts/partials/css/owlCarousel.html new file mode 100644 index 0000000..d42e685 --- /dev/null +++ b/layouts/partials/css/owlCarousel.html @@ -0,0 +1,4 @@ +{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.css" }} +{{ $owlCarouselTheme := resources.Get "vendor/owlCarousel/owl.theme.default.min.css" }} +{{ $owlCarouselBundle := slice $owlCarousel $owlCarouselTheme | resources.Concat "/styles/owlCarousel.min.css" | fingerprint }} +<link rel="stylesheet" href="{{ $owlCarouselBundle.Permalink }}" integrity="{{ $owlCarouselBundle.Data.Integrity }}" media="screen"> diff --git a/layouts/partials/footer/scripts.html b/layouts/partials/footer/scripts.html index bb81fc7..e3533d4 100644 --- a/layouts/partials/footer/scripts.html +++ b/layouts/partials/footer/scripts.html @@ -1,15 +1,6 @@ {{ $jQuery := resources.Get "vendor/jquery/jquery-3.3.1.min.js" }} -{{ $index := resources.Get "js/index.js" | resources.ExecuteAsTemplate "js/index.tmp.css" . | minify }} - -{{ if and .Site.Params.localTime .Page.IsHome }} -{{ $momentjs := resources.Get "vendor/momentjs/moment.min.js" }} -{{ $momentTimezone := resources.Get "vendor/momentjs/moment-timezone.min.js" }} -{{ $momentTimezoneWithData := resources.Get "vendor/momentjs/moment-timezone-with-data-2012-2022.min.js" }} -{{ $scripts := slice $jQuery $momentjs $momentTimezone $momentTimezoneWithData $index | resources.Concat "/js/bundleMoment.js" | fingerprint }} -<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> -{{ else }} +{{ $index := resources.Get "js/index.js" | minify }} {{ $scripts := slice $jQuery $index | resources.Concat "/js/bundle.js" | fingerprint }} <script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> -{{ end }} {{ template "_internal/google_analytics_async.html" . }} diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html index ee8046a..0079b5f 100644 --- a/layouts/partials/head/css.html +++ b/layouts/partials/head/css.html @@ -1,16 +1,18 @@ -{{ $file := "sass/style.sass" }} +{{ $bundleRaw := resources.Get "sass/style.sass" | resources.ExecuteAsTemplate "style/main.tmp.css" . }} + {{ if .Site.IsServer }} {{ $cssOpts := (dict "targetPath" "styles/main.css" "enableSourceMap" true ) }} -{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts }} -<link rel="stylesheet" href="{{ $styles.Permalink }}" media="screen"> +{{ $bundle := $bundleRaw | toCSS $cssOpts }} +<link rel="stylesheet" href="{{ $bundle.Permalink }}" media="screen"> {{ else }} {{ $cssOpts := (dict "targetPath" "styles/main.css" ) }} {{ $postCSSOpts := (dict "use" "autoprefixer" ) }} -{{ $styles := resources.Get $file | resources.ExecuteAsTemplate "style/main.tmp.css" . | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }} -<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen"> +{{ $bundle := $bundleRaw | toCSS $cssOpts | postCSS $postCSSOpts | minify | fingerprint }} +<link rel="stylesheet" href="{{ $bundle.Permalink }}" integrity="{{ $bundle.Data.Integrity }}" media="screen"> {{ end }} <!-- Custom css --> {{ range .Site.Params.customCSS -}} - <link rel="stylesheet" href="{{ . | relURL }}"> + {{ $style := resources.Get . }} + <link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}" media="screen"> {{- end }} diff --git a/layouts/partials/head/favicons.html b/layouts/partials/head/favicons.html index c6813e9..2e77ade 100644 --- a/layouts/partials/head/favicons.html +++ b/layouts/partials/head/favicons.html @@ -1,2 +1,3 @@ -<!-- Icon --> -<link rel="shortcut icon" href="{{ .Site.Params.faviconFile | default "img/favicon.ico" | relURL }}"> +{{ with .Site.Params.favicon }} +<link rel="shortcut icon" href="{{ . | absURL }}"> +{{ end }} diff --git a/layouts/partials/head/openGraph.html b/layouts/partials/head/openGraph.html index 8022127..d613451 100644 --- a/layouts/partials/head/openGraph.html +++ b/layouts/partials/head/openGraph.html @@ -9,5 +9,9 @@ <meta property="og:image" content="{{ .Permalink }}"/> {{ end }} {{ else }} -<meta property="og:image" content="{{ .Site.Params.avatar | absURL }}"/> +{{ with .Site.GetPage "page" "/home" }} +{{ range first 5 (.Resources.ByType "image") }} +<meta property="og:image" content="{{ .Permalink }}"/> +{{ end }} +{{ end }} {{ end }} diff --git a/layouts/partials/home/blog.html b/layouts/partials/home/blog.html index b26801c..67719bc 100644 --- a/layouts/partials/home/blog.html +++ b/layouts/partials/home/blog.html @@ -1,27 +1,27 @@ -{{ with .Site.GetPage "section" "blog" }} +{{ with .Site.GetPage "/blog" }} <div class="section" id="{{ .Title | urlize }}"> <!-- Begin Blog container --> <div class="container"> - {{ if .Site.Params.showLatest }} + {{ if .Site.Params.home.showLatest | default true }} <h2 class="title is-2 has-text-centered">{{ i18n "index_blog_latestPosts" . }}</h2> {{ range first 1 .Pages.ByPublishDate.Reverse }} - <div class="summary">{{ .Date.Format (.Site.Params.dateForm | default "Jan 02, 2006") }} - <h3 class="title is-3 latest-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3> + <div class="summary">{{ .Date.Format (.Site.Params.dateFormat | default "Jan 02, 2006") }} + <h3 class="title is-3 latest-post-title"><a href="{{ .Permalink }}">{{ .Title }}</a></h3> <div class="markdown"> {{ .Summary }} {{ if .Truncated }} - <a href="{{ .RelPermalink }}">{{ i18n "index_blog_readMore" . }}</a> + <a href="{{ .Permalink }}">{{ i18n "index_blog_readMore" . }}</a> {{ end }} </div> </div> {{ end }} {{ end }} - {{ if .Site.Params.showAllPosts }} + {{ if .Site.Params.home.showAllPosts }} <h2 class="title is-2 has-text-centered top-pad">{{ i18n "index_blog_allPosts" . }}</h2> {{ partialCached "blog/li.html" . }} {{ else }} <div class="container has-text-centered top-pad"> - <a href="{{ .RelPermalink }}">{{ i18n "index_blog_allPosts" . }}</a> + <a href="{{ .Permalink }}">{{ i18n "index_blog_allPosts" . }}</a> </div> {{ end }} </div> diff --git a/layouts/partials/home/projects.html b/layouts/partials/home/projects.html index 2c51a8b..324573f 100644 --- a/layouts/partials/home/projects.html +++ b/layouts/partials/home/projects.html @@ -1,27 +1,30 @@ -{{ with .Site.GetPage "section" "projects" }} +{{ with .Site.GetPage "/projects" }} <div class="section" id="{{ .Title | urlize }}"> <!-- Begin Projects container --> <div class="container"> <h2 class="title is-2 has-text-centered"> {{ .Title }} </h2> - <div class="section is-small"> + <div class="section"> <div class="columns is-multiline"> {{ $totalProjects := (len .Pages) }} - {{ $numberOfProjectsToShow := .Site.Params.numberOfProjectsToShow | default $totalProjects }} + {{ $numberOfProjectsToShow := .Site.Params.home.numberOfProjectsToShow | default $totalProjects }} {{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }} - {{ if eq (mod $numberOfProjectsToShow 2) 0 }} + {{ if .Site.Params.projects.useTwoColumns }} + {{ .Scratch.Set "width" "490x" }} <div class="column is-half"> {{ else }} + {{ .Scratch.Set "width" "302x" }} <div class="column is-one-third"> {{ end }} <div class="card" data-target="#project-{{ $index }}"> <div class="card-image"> <figure class="image is-3by2"> <a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}> + {{ $width := ( .Scratch.Get "width" ) }} {{ with .Resources.ByType "image" }} {{ range first 1 (sort . "Params.weight") }} - {{ $image := .Resize "302x" }} + {{ $image := .Resize $width }} <img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}"> {{ end }} {{ end }} @@ -30,6 +33,7 @@ </div> <div class="card-content has-text-centered top-pad"> <a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}> + {{ .Params.external_link }} {{ .Title }} </a> </div> @@ -40,7 +44,7 @@ </div> {{ if lt $numberOfProjectsToShow $totalProjects }} <div class="container has-text-centered top-pad"> - <a href="{{ .RelPermalink }}">{{ i18n "index_projects_allProjects" . }}</a> + <a href="{{ .Permalink }}">{{ i18n "index_projects_allProjects" . }}</a> </div> {{ end }} </div> @@ -58,9 +62,22 @@ {{ end }} {{ with .Resources.ByType "image" }} - {{ range first 1 (sort . "Params.weight") }} - {{ $image := .Resize "640x" }} - <img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}"> + {{ $moreThenOneImage := gt (len .) 1 }} + {{ if $moreThenOneImage }} + <div class="owl-carousel owl-theme"> + {{ end }} + {{ range sort . "Params.weight" }} + {{ $image := .Resize "640x" }} + {{ if $moreThenOneImage }} + <div class="item owl-height"> + {{ end }} + <img src="{{ $image.Permalink }}" class="img-responsive" alt="{{ $image.Name }}"> + {{ if $moreThenOneImage }} + </div> + {{ end }} + {{ end }} + {{ if $moreThenOneImage }} + </div> {{ end }} {{ end }} diff --git a/layouts/partials/js/owlCarousel.html b/layouts/partials/js/owlCarousel.html new file mode 100644 index 0000000..34fb45e --- /dev/null +++ b/layouts/partials/js/owlCarousel.html @@ -0,0 +1,5 @@ +{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.js" }} +{{ $initOwlCarousel := resources.Get "js/initOwlCarousel.js" | minify }} +{{ $bundleOwlCarousel := slice $owlCarousel $initOwlCarousel | resources.Concat "/js/bundleOwlCarousel.js" | fingerprint }} + +<script src="{{ $bundleOwlCarousel.Permalink }}" integrity="{{ $bundleOwlCarousel.Data.Integrity }}"></script> diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html index a619581..ba0f13e 100644 --- a/layouts/partials/nav.html +++ b/layouts/partials/nav.html @@ -37,19 +37,28 @@ {{ else }} <!-- use default menu --> {{ if not $isHome }} - <a class="navbar-item" href="{{ "/" | relLangURL }}">{{ i18n "nav_main" . }}</a> + <a class="navbar-item" href="{{ "/" | absLangURL }}">{{ i18n "nav_main" . }}</a> + {{ end }} + + {{ with .Site.GetPage "/home" }} + {{ range sort (.Resources.ByType "page") "Params.weight" }} + {{ if ne .Name "contact.md" }} + <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | absLangURL }}{{ end }}">{{ .Title }}</a> + {{ end }} {{ end }} - {{ with .Site.GetPage "page" "about" }} - <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a> {{ end }} {{ $pageIsInProjects := eq .Page.Section "projects"}} {{ if not (and $pageIsInProjects (eq .Page.Kind "section")) }} - {{ with .Site.GetPage "section" "projects" }} + {{ with .Site.GetPage "/projects" }} + {{ $totalProjects := (len .Pages) }} + {{ $numberOfProjectsToShow := .Site.Params.home.numberOfProjectsToShow | default $totalProjects }} {{ if $isHome }} - <a class="navbar-item" href="#{{ .Title | urlize }}">{{ .Title }}</a> + <a class="navbar-item" href="{{ printf "#%s" (.Title | urlize) }}">{{ .Title }}</a> + {{ else if le $totalProjects $numberOfProjectsToShow }} + <a class="navbar-item" href="{{ printf "/#%s" (.Title | urlize) | relLangURL }}">{{ .Title }}</a> {{ else }} - <a class="navbar-item" href="{{ .RelPermalink }}"> + <a class="navbar-item" href="{{ .Permalink }}"> {{ if $pageIsInProjects }} {{ i18n "nav_backToSection" . }} {{ else }} @@ -62,11 +71,11 @@ {{ $pageIsInBlog := eq .Page.Section "blog"}} {{ if not (and $pageIsInBlog (eq .Page.Kind "section")) }} - {{ with .Site.GetPage "section" "blog" }} + {{ with .Site.GetPage "/blog" }} {{ if $isHome }} - <a class="navbar-item" href="#{{ .Title | urlize }}">{{ .Title }}</a> + <a class="navbar-item" href="{{ printf "#%s" (.Title | urlize) }}">{{ .Title }}</a> {{ else }} - <a class="navbar-item" href="{{ .RelPermalink }}"> + <a class="navbar-item" href="{{ .Permalink }}"> {{ if $pageIsInBlog }} Back to {{ .Title | singularize}} {{ else }} @@ -77,8 +86,10 @@ {{ end }} {{ end }} - {{ with .Site.GetPage "page" "contact" }} - <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | relLangURL }}{{ end }}">{{ .Title }}</a> + {{ with .Site.GetPage "/home" }} + {{ with .Resources.GetMatch "contact.md" }} + <a class="navbar-item" href="{{ if $isHome }}#{{ .File.TranslationBaseName }}{{ else }}{{ printf "/#%s" .File.TranslationBaseName | absLangURL }}{{ end }}">{{ .Title }}</a> + {{ end }} {{ end }} {{ if gt (len $.Site.Home.AllTranslations.ByWeight) 1 }} @@ -95,31 +106,4 @@ </nav> <hr> </div> -<script> -document.addEventListener('DOMContentLoaded', function () { - - // Get all "navbar-burger" elements - var $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); - - // Check if there are any navbar burgers - if ($navbarBurgers.length > 0) { - - // Add a click event on each of them - $navbarBurgers.forEach(function ($el) { - $el.addEventListener('click', function () { - - // Get the target from the "data-target" attribute - var target = $el.dataset.target; - var $target = document.getElementById(target); - - // Toggle the class on both the "navbar-burger" and the "navbar-menu" - $el.classList.toggle('is-active'); - $target.classList.toggle('is-active'); - - }); - }); - } - -}); -</script> <!-- End Nav bar --> diff --git a/layouts/partials/top-icon-with-hr.html b/layouts/partials/top-icon-with-hr.html index a077275..4595a80 100644 --- a/layouts/partials/top-icon-with-hr.html +++ b/layouts/partials/top-icon-with-hr.html @@ -1,7 +1,7 @@ -<div class="container top-pad"> +<div class="container"> <hr> </div> {{ partial "top-icon.html" . }} -<div class="container top-pad"> +<div class="container"> <hr> </div> diff --git a/layouts/projects/list.html b/layouts/projects/list.html index 619253e..a4f6e1a 100644 --- a/layouts/projects/list.html +++ b/layouts/projects/list.html @@ -3,22 +3,25 @@ {{ .Content }} </div> <div class="container"> - <div class="section is-small"> + <div class="section"> <div class="columns is-multiline"> {{ $numberOfPages := len .Pages}} {{ range .Pages.ByWeight }} - {{ if eq (mod $numberOfPages 2) 0 }} + {{ if .Site.Params.projects.useTwoColumns }} + {{ .Scratch.Set "width" "490x" }} <div class="column is-half"> {{ else }} + {{ .Scratch.Set "width" "302x" }} <div class="column is-one-third"> {{ end }} <div class="card"> <div class="card-image"> <figure class="image is-3by2"> <a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{ .Permalink }}{{ end }}"> + {{ $width := ( .Scratch.Get "width" ) }} {{ with .Resources.ByType "image" }} {{ range first 1 (sort . "Params.weight") }} - {{ $image := .Resize "302x" }} + {{ $image := .Resize $width }} <img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}"> {{ end }} {{ end }} @@ -26,7 +29,7 @@ </figure> </div> <div class="card-content has-text-centered top-pad"> - <a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{.Permalink}}{{ end }}"> + <a href="{{ if .Params.external_link }}{{ .Params.external_link }}{{ else }}{{ .Permalink }}{{ end }}"> {{ .Title }} </a> </div> diff --git a/layouts/projects/single.html b/layouts/projects/single.html index 01cd002..98176e8 100644 --- a/layouts/projects/single.html +++ b/layouts/projects/single.html @@ -30,24 +30,9 @@ {{ end }} {{ define "customCSS" }} -{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.css" }} -{{ $owlCarouselTheme := resources.Get "vendor/owlCarousel/owl.theme.default.min.css" }} -{{ $owlCarouselBundle := slice $owlCarousel $owlCarouselTheme | resources.Concat "/css/owlCarousel.min.css" | fingerprint }} -<link rel="stylesheet" href="{{ $owlCarouselBundle.Permalink }}" integrity="{{ $owlCarouselBundle.Data.Integrity }}" media="screen"> +{{ partial "css/owlCarousel.html" . }} {{ end }} {{ define "customScripts" }} -{{ $owlCarousel := resources.Get "vendor/owlCarousel/owl.carousel.min.js" | fingerprint }} -<script src="{{ $owlCarousel.Permalink }}" integrity="{{ $owlCarousel.Data.Integrity }}"></script> -<script> - $(document).ready(function(){ - $(".owl-carousel").owlCarousel({ - loop: true, - nav: true, - margin: 10, - items: 1, - autoHeight: true - }); - }); -</script> +{{ partial "js/owlCarousel.html" . }} {{ end }} |