Refactor config.toml

This commit is contained in:
Hanzei 2018-07-20 14:45:36 +02:00
parent 64b7e1b010
commit ef5feab3ef
No known key found for this signature in database
GPG key ID: 69A2DEFD98937BA0
10 changed files with 97 additions and 91 deletions

View file

@ -1,4 +1,4 @@
$(document).ready(function() { $(document).ready(function() {
var time = moment().tz("{{ .Site.Params.timeZone }}").format("h:mm A"); var time = moment().tz("{{ .Site.Params.home.timeZone }}").format("h:mm A");
$('#time').html(time); $('#time').html(time);
}) })

View file

@ -1,54 +1,57 @@
baseURL = "https://example.org/" # Your domain name. Must end with "/" baseURL = "https://example.org/" # Your domain name. Must end with "/"
DefaultContentLanguage = "en"
theme = "introduction" theme = "introduction"
# disqusshortname = "" # Enable Disqus for comments https://gohugo.io/content-management/comments DefaultContentLanguage = "en" # Default language for multilingual sites
# googleAnalytics = "" # Enable Google Analytics https://gohugo.io/templates/internal/#google-analytics # disqusshortname = "" # https://gohugo.io/content-management/comments
# googleAnalytics = "" # https://gohugo.io/templates/internal/#google-analytics
[params] [params]
introHeight = "large" # Input either 'medium' or 'large' or 'fullheight' themeStyle = "light" # Choose "light" or "dark"
themeStyle = "light" # Choose 'light' or 'dark' favicon = "/img/fav.ico" # Path to favicon file
faviconFile = "img/fav.ico" showRSSButton = false # Show rss button in navigation
fadeIn = true # Turn on/off the fade-in effect
dateFormat = "Jan 2, 2006"
customCSS = ["css/foo.css"] # Include custom css files
# Configure the home page
[params.home]
introHeight = "large" # Input either "medium" or "large" or "fullheight"
showLatest = true # Show latest blog post summary
showAllPosts = false # Set true to list all posts on home page, or set false to link to separate blog list page
numberOfProjectsToShow = 3 # Maximum number of projects to show on home page. Unset or comment out to show all projects
email = "youremail@email.com" # Shows in contact section, or leave blank to omit email = "youremail@email.com" # Shows in contact section, or leave blank to omit
localTime = true # Show your current local time in contact section localTime = true # Show your current local time in contact section
timeZone = "America/Los_Angeles" # Your timezone as in the TZ* column of this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones timeZone = "America/Los_Angeles" # Your timezone as in the TZ* column of this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
dateForm = "Jan 2, 2006"
fadeIn = true # Turn on/off the fade-in effect
showRSSButton = true # Show rss button in navigation
customCSS = [] # Include custom css files e.g. ["css/foo.css", "css/bar.css"]
showAllPosts = false # Set 'true' to list all posts on home page, or set 'false' to link to separate blog list page
showLatest = true # Show latest blog post summary
# Share buttons on blog post pages # Share buttons on blog post pages
shareButtons = true # Show "Share this:" social buttons [params.share]
shareTwitter = true twitter = true
shareFacebook = true facebook = true
sharePinterest = false googlePlus = true
shareGooglePlus = true pinterest = true
numberOfProjectsToShow = 3 # Maximum number of projects to show on home page. Unset or comment out to show all projects. # Social icons appear in introduction and contact section. Add as many more as you like.
# Find icon names here: https://fontawesome.com/cheatsheet/
# Social icons appear in introduction and contact section. Add as many more as you like. [[params.social]]
# Find icon names here: http://fontawesome.io/cheatsheet/
[[params.social]]
url = "https://twitter.com/" url = "https://twitter.com/"
icon = "twitter" icon = "twitter"
[[params.social]] [[params.social]]
url = "https://facebook.com/" url = "https://facebook.com/"
icon = "facebook-f" icon = "facebook-f"
[[params.social]] [[params.social]]
url = "https://linkedin.com/" url = "https://linkedin.com/"
icon = "linkedin-in" icon = "linkedin-in"
# If you don`t want to use the default menu, you can define one by yoursel # If you don`t want to use the default menu, you can define one by yourself
# [[menu.main]] # [[menu.main]]
# name = "Home" # name = "Home"
# url = "/" # url = "/"
# weight = 0 # weight = 0
# [[menu.main]] # [[menu.main]]
# name = "Blog" # name = "Blog"
# url = "/blog" # url = "/blog/"
# weight = 1 # weight = 1
#
[languages] [languages]
[languages.en] [languages.en]
languageName = "English" languageName = "English"
@ -58,7 +61,8 @@ theme = "introduction"
title = "Introduction" title = "Introduction"
[languages.en.params] [languages.en.params]
description = "Website Description" # Max 160 characters show in search results description = "Website Description" # Max 160 characters show in search results
footerText = "" # Text to override default footer text (markdown allowed) # footerText = "" # Text to override default footer text (markdown allowed)
[languages.es] [languages.es]
languageName = "Español" languageName = "Español"
languageCode = "es" languageCode = "es"
@ -67,7 +71,8 @@ theme = "introduction"
title = "Introducción" title = "Introducción"
[languages.es.params] [languages.es.params]
description = "Descripcion del sitio web" description = "Descripcion del sitio web"
footerText = "" # footerText = ""
[languages.de] [languages.de]
languageName = "Deutsch" languageName = "Deutsch"
languageCode = "de" languageCode = "de"
@ -75,6 +80,6 @@ theme = "introduction"
weight = 2 weight = 2
title = "Vorstellung" title = "Vorstellung"
[languages.de.params] [languages.de.params]
description = "Beschreibung der Webseite"
footerText = ""
dateForm = "2. January 2006" dateForm = "2. January 2006"
description = "Beschreibung der Webseite"
# footerText = ""

View file

@ -3,10 +3,10 @@
{{ .Content }} {{ .Content }}
</div> </div>
<div class="container"> <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> <h2 class="title is-2 top-pad">{{ i18n "index_blog_latestPosts" . }}</h2>
{{ range first 1 .Pages.ByPublishDate.Reverse }} {{ 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"> <h3 class="title is-3 strong-post-title">
<a href="{{ .RelPermalink }}"> <a href="{{ .RelPermalink }}">
{{ .Title }} {{ .Title }}

View file

@ -8,31 +8,31 @@
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Title }}</a>
</h2> </h2>
<div class="post-data"> <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 }} {{ i18n "blog_readingTime" .ReadingTime }}
</div> </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"> <div class="blog-share">
{{ i18n "blog_shareThis" . }}: {{ 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;"> <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> <i class="fab fa-twitter"></i>
<span class="hidden">Twitter</span> <span class="hidden">Twitter</span>
</a> </a>
{{ end }} {{ 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;"> <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> <i class="fab fa-facebook-f"></i>
<span class="hidden">Facebook</span> <span class="hidden">Facebook</span>
</a> </a>
{{ end }} {{ 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 }}&amp;media={{ .Site.BaseURL }}{{ .Params.pinterestMedia }}{{ end }}&amp;description={{ .Title | safeHTML}}" onclick="window.open(this.href, 'pinterest-share','width=580,height=296');return false;"> <a class="icon-pinterest" href="http://pinterest.com/pin/create/button/?url={{ .Permalink }}{{ if .Params.pinterestMedia }}&amp;media={{ .Site.BaseURL }}{{ .Params.pinterestMedia }}{{ end }}&amp;description={{ .Title | safeHTML}}" onclick="window.open(this.href, 'pinterest-share','width=580,height=296');return false;">
<i class="fab fa-pinterest-p"></i> <i class="fab fa-pinterest-p"></i>
<span class="hidden">Pinterest</span> <span class="hidden">Pinterest</span>
</a> </a>
{{ end }} {{ 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;"> <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> <i class="fab fa-google-plus-g"></i>
<span class="hidden">Google+</span> <span class="hidden">Google+</span>

View file

@ -10,7 +10,7 @@
<body> <body>
<div id="top"> <div id="top">
{{ with .Site.GetPage "page" "home" }} {{ with .Site.GetPage "page" "home" }}
<div class="hero is-{{ .Site.Params.introHeight | default "fullheight" }}"> <div class="hero is-{{ .Site.Params.home.introHeight | default "large" }}">
<!-- Super sweet Hero body title --> <!-- Super sweet Hero body title -->
<div class="hero-body"> <div class="hero-body">
<div class="container has-text-centered"> <div class="container has-text-centered">
@ -83,12 +83,12 @@
<div class="markdown"> <div class="markdown">
{{ .Content }} {{ .Content }}
</div> </div>
{{ if .Site.Params.localTime }} {{ if .Site.Params.home.localTime }}
<p>{{ i18n "index_currentTime" . }} <span id='time'></span>.</p> <p>{{ i18n "index_currentTime" . }} <span id='time'></span>.</p>
{{ end }} {{ end }}
{{ if .Site.Params.email }} {{ with .Site.Params.home.email }}
<h3 class="subtitle is-3 has-text-centered top-pad"> <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> </h3>
{{ end }} {{ end }}
{{ partial "home/social.html" . }} {{ partial "home/social.html" . }}
@ -107,5 +107,14 @@
<!-- End of fade in three section --> <!-- End of fade in three section -->
{{ partial "footer/scripts.html" . }} {{ partial "footer/scripts.html" . }}
{{ partial "js/owlCarousel.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> </body>
</html> </html>

View file

@ -3,13 +3,4 @@
{{ $scripts := slice $jQuery $index | resources.Concat "/js/bundle.js" | fingerprint }} {{ $scripts := slice $jQuery $index | resources.Concat "/js/bundle.js" | fingerprint }}
<script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script> <script src="{{ $scripts.Permalink }}" integrity="{{ $scripts.Data.Integrity }}"></script>
{{ 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" }}
{{ $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 }}
{{ template "_internal/google_analytics_async.html" . }} {{ template "_internal/google_analytics_async.html" . }}

View file

@ -1,2 +1,3 @@
<!-- Icon --> {{ with .Site.Params.favicon }}
<link rel="shortcut icon" href="{{ .Site.Params.faviconFile | default "img/favicon.ico" | relURL }}"> <link rel="shortcut icon" href="{{ . | relURL }}">
{{ end }}

View file

@ -2,10 +2,10 @@
<div class="section" id="{{ .Title | urlize }}"> <div class="section" id="{{ .Title | urlize }}">
<!-- Begin Blog container --> <!-- Begin Blog container -->
<div class="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> <h2 class="title is-2 has-text-centered">{{ i18n "index_blog_latestPosts" . }}</h2>
{{ range first 1 .Pages.ByPublishDate.Reverse }} {{ 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 latest-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3> <h3 class="title is-3 latest-post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h3>
<div class="markdown"> <div class="markdown">
{{ .Summary }} {{ .Summary }}
@ -16,7 +16,7 @@
</div> </div>
{{ end }} {{ end }}
{{ 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> <h2 class="title is-2 has-text-centered top-pad">{{ i18n "index_blog_allPosts" . }}</h2>
{{ partialCached "blog/li.html" . }} {{ partialCached "blog/li.html" . }}
{{ else }} {{ else }}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB