Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating templates to make them more w3c compatible. #103

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
22 changes: 22 additions & 0 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ author = "Yoshiharu Yamashita"
copyright = "© 2016. All rights reserved."
canonifyurls = true
paginate = 10
# i18n support
DefaultContentLanguage = "en"
# DefaultContentLanguage = "en-us"
# DefaultContentLanguage = "ja"

[indexes]
tag = "tags"
Expand All @@ -21,6 +25,24 @@ paginate = 10
highlightjs = "androidstudio"
dateFormat = "02 Jan 2006, 15:04"

# i18n config
# [languages]
# [languages.en]
# title = "My blog"
# weight = 1
# [languages.en.params]
# [languages.en-us]
# weight = 2
# [languages.en-us.params]
# dateFormat = "Jan 02 2006 15:04"
# [languages.ja]
# title = "私の日記"
# weight = 2
# [languages.ja.params]
# dateFormat = "2006年1月02日 15:04"
# subtitle = "Hugoのテーマ"


[menu]
# Shown in the side menu.
[[menu.main]]
Expand Down
8 changes: 8 additions & 0 deletions layouts/partials/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<link rel="stylesheet" href="{{ $.Site.BaseURL }}{{ . }}">
{{ end }}
{{ end }}

{{ range .Site.Params.custom_js }}
{{ if findRE "https?://" . }}
<script src="{{ . }}"></script>
Expand All @@ -71,4 +72,11 @@
{{ end }}
{{ end }}

{{ range .Params.custom_css }}
<link rel="stylesheet" href="{{ . }}">
{{ end }}
{{ range .Params.custom_js }}
<script src="{{ . }}"></script>
{{ end }}

</head>
2 changes: 1 addition & 1 deletion layouts/partials/header.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en">
<html lang="{{ .Site.Language.Lang }}">

{{ partial "head.html" . }}

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/pagination.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }}
{{ $prev := "fa fa-chevron-left"}}
{{ $next := "fa fa-chevron-right"}}
<nav class="pagination" role="pagination">
<nav class="pagination">
{{ if .Paginator.HasPrev }}
<a href="{{ .Paginator.Prev.URL }}"><i class="{{ $prev }}"></i></a>
{{ else }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/post_meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div>
<i class="fa fa-calendar fa-fw"></i>
<time>{{ with .Site.Params.dateFormat }}{{ $.Date.Format . }}{{ else }}{{ .Date.Format "02 Jan 2006, 15:04" }}{{ end }}</time>
<time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ with .Site.Params.dateFormat }}{{ $.Date.Format . }}{{ else }}{{ .Date.Format "02 Jan 2006, 15:04" }}{{ end }}</time>
</div>

{{ $baseUrl := .Site.BaseURL }}
Expand Down
24 changes: 12 additions & 12 deletions layouts/partials/share.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<h4><i class="fa-share-alt" aria-hidden="true"></i>&nbsp;Share!</h4>
<h4>Share!</h4>
<ul class="share-buttons">
<li><a href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" title="Share on Facebook"><i class="fa-facebook" aria-hidden="true"></i><span class="sr-only">Share on Facebook</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="https://twitter.com/intent/tweet?source={{ .Permalink }}&via=HorribleGeek" target="_blank" title="Tweet"><i class="fa-twitter" aria-hidden="true"></i><span class="sr-only">Tweet</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="https://plus.google.com/share?url={{ .Permalink }}" target="_blank" title="Share on Google+"><i class="fa-google-plus" aria-hidden="true"></i><span class="sr-only">Share on Google+</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="http://www.tumblr.com/share?v=3&u={{ .Permalink }}" target="_blank" title="Post to Tumblr"><i class="fa-tumblr" aria-hidden="true"></i><span class="sr-only">Post to Tumblr</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="http://pinterest.com/pin/create/button/?url={{ .Permalink }}" target="_blank" title="Pin it"><i class="fa-pinterest-p" aria-hidden="true"></i><span class="sr-only">Pin it</span></a>
</li>&nbsp;&nbsp;&nbsp;
<li><a href="http://www.reddit.com/submit?url={{ .Permalink }}" target="_blank" title="Submit to Reddit"><i class="fa-reddit-alien" aria-hidden="true"></i><span class="sr-only">Submit to Reddit</span></a>
<li><a href="https://www.facebook.com/sharer/sharer.php?u={{ .Permalink }}" target="_blank" title="Share on Facebook"><i class="fab fa-facebook" aria-hidden="true"></i><span class="sr-only">Share on Facebook</span></a> &nbsp;
</li>
<li><a href="https://twitter.com/intent/tweet?source={{ .Permalink }}&via=HorribleGeek" target="_blank" title="Tweet"><i class="fab fa-twitter" aria-hidden="true"></i><span class="sr-only">Tweet</span></a> &nbsp;
</li>
<li><a href="http://www.tumblr.com/share?v=3&u={{ .Permalink }}" target="_blank" title="Post to Tumblr"><i class="fab fa-tumblr" aria-hidden="true"></i><span class="sr-only">Post to Tumblr</span></a>
&nbsp;
</li>
<li><a href="http://pinterest.com/pin/create/button/?url={{ .Permalink }}" target="_blank" title="Pin it"><i class="fab fa-pinterest-p" aria-hidden="true"></i><span class="sr-only">Pin it</span></a>
&nbsp;
</li>
<li><a href="http://www.reddit.com/submit?url={{ .Permalink }}" target="_blank" title="Submit to Reddit"><i class="fab fa-reddit-alien" aria-hidden="true"></i><span class="sr-only">Submit to Reddit</span></a> &nbsp;
</li>
</ul>

Expand Down
6 changes: 6 additions & 0 deletions layouts/partials/social.html
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://github.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-github-square fa-fw"></i>GitHub</a>
</li>
{{ end }}

{{ with .Site.Social.freecodecamp }}
<li class="pure-menu-item">
<a class="pure-menu-link" href="https://freecodecamp.com/{{ . }}" rel="me" target="_blank"><i class="fab fa-freecodecamp-square fa-fw"></i>freecodecamp</a>
</li>
{{ end }}

{{ with .Site.Social.gitlab }}
Expand Down
23 changes: 23 additions & 0 deletions layouts/shortcodes/tsxBuild.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{/*
I still haven't figured out how to range over the script files
really well. but I have managed to get typescript built with this.
the other things that need changing are compiler options.
which I recommend writing out of the loop maybe even in config.toml?
I dont think I need to put this in a partial because not every
web page needs it.

*/}}

{{ range .Page.Resources.ByType "typescript" }}
{{ $ts := (js.Build .) }}
<script src="{{ $ts.RelPermalink }}"
{{ with .Params.async }}
async="{{ . }}" {{ end}}></script>
{{ end }}

{{ range .Page.Resources.ByType "jsx" }}
{{ $jsx := (js.Build .) }}
<script src="{{ $jsx.RelPermalink }}"
{{ with .Params.async }}
async="{{ . }}" {{ end}}></script>
{{ end }}