Restructures the templates

This commit is contained in:
Huy Tran 2018-07-10 11:41:30 +10:00
parent 6b929ff8e0
commit f4aa888a5c
14 changed files with 108 additions and 128 deletions

View file

@ -1,16 +1,14 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
{{ block "header" . -}}{{- end }}
<body class="{{- if .Site.Params.themeColor }}{{ .Site.Params.themeColor }}{{ end }} {{if .Site.Params.layoutReverse}}layout-reverse{{end}}">
{{ partial "sidebar.html" . }}
<body {{- if .Site.Params.themeColor }}class="{{ .Site.Params.themeColor }} {{if .Site.Params.layoutReverse}}layout-reverse{{ end }}"{{end}}>
{{ partial "sidebar.html" . -}}
<div class="content container">
{{ block "content" . }}{{ end }}
<div class="footer">
{{ block "footer" . }}{{ end }}
</div>
{{ block "content" . -}}{{- end }}
</div>
<!-- Google Analytics -->
{{ if .Site.GoogleAnalytics -}}
{{ block "footer" . -}}{{- end }}
{{ if and (not .Site.BuildDrafts) (.Site.GoogleAnalytics) -}}
{{ "<!-- Google Analytics -->" | safeHTML }}
{{ template "_internal/google_analytics_async.html" . }}
{{- end }}
</body>

View file

@ -7,6 +7,8 @@
{{- end -}}
{{ define "footer" -}}
{{ partial "highlight.html" . }}
{{ partial "commenting.html" . }}
<div class="footer content">
{{- partial "highlight.html" . -}}
{{- partial "commenting.html" . -}}
</div>
{{- end -}}

View file

@ -4,22 +4,22 @@
{{ define "content" -}}
<div class="posts">
{{ range (where .Data.Pages "Type" "!=" "about").GroupBy "Section" }}
{{ range (where .Data.Pages "Type" "not in" (slice "about" "portfolio")).GroupBy "Section" -}}
{{ range .Pages }}
<div class="post">
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title }}</a>{{ if .Draft }}<sup><i class="fas fa-pen-square fa-xs"></i></sup>{{ end }}</h1>
<h1 class="post-title"><a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ if .Draft }}<sup> <i class="fas fa-pen-square fa-xs"></i></sup>{{ end }}</h1>
<span class="post-date">
{{- .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") -}}
</span>
{{ .Summary }}
{{ if .Truncated }}
{{ .Summary }}
{{- if .Truncated }}
<div class="read-more-link">
<a href="{{ .RelPermalink }}">Read More…</a>
</div>
{{ end }}
{{- end }}
</div>
{{- end -}}
{{- end }}
{{- end -}}
{{- end }}
</div>
{{- end }}

View file

@ -1,14 +1,11 @@
<!-- Disqus-->
{{ if .Site.DisqusShortname -}}
{{ if ne .Params.showcomments false }}
{{- if and (not .Site.BuildDrafts) (ne .Params.showcomments false) -}}
{{ if .Site.DisqusShortname -}}
<hr>
<h2>Comments</h2>
{{ partial "commenting_disqus.html" . }}
{{ end }}
{{ else if .Site.Params.GraphCommentId -}}
{{ if ne .Params.showcomments false }}
{{- partial "commenting/disqus.html" . -}}
{{- else if .Site.Params.GraphCommentId -}}
<hr>
<h2>Comments</h2>
{{ partial "commenting_graph.html" . }}
{{ end }}
{{- end }}
{{- partial "commenting/graphcomment.html" . -}}
{{- end -}}
{{- end }}

View file

@ -1,9 +1,9 @@
<h1 class="title">{{ .Title }}</h1>
<ul class="posts">
{{ range .Data.Pages -}}
{{- range .Data.Pages -}}
<li>
<span>
<a href="{{ .Permalink }}">{{ .Title }}</a>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
{{ if not .Date.IsZero }}
<time class="pull-right post-list">
{{- .Date.Format (.Site.Params.dateformat | default "Jan 02, 2006") -}}

View file

@ -1,7 +1,7 @@
{{ if .Site.Params.highlightjs -}}
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
{{ range .Site.Params.highlightjslanguages }}
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/{{.}}.min.js"></script>
{{ with .Site.Params.highlightjslanguages }}
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/languages/{{.}}.min.js"></script>
{{ end }}
<script type="text/javascript">
hljs.configure({languages: []});

View file

@ -1,15 +1,16 @@
{{ "<!-- Sidebar -->" | safeHTML }}
<div class="sidebar">
<div class="container text-center {{ if .Site.Params.sidebarSticky }}sidebar-sticky{{ end }}">
<div class="sidebar-about text-center">
<a href="{{ .Site.BaseURL }}"><h1 class="brand">{{ .Site.Title }}</h1></a>
{{ with .Site.Params.authorimage }} <img src="{{.}}" alt="Author Image" class="img-circle headshot center"> {{ end }}
{{ with .Site.Params.authorimage }} <img src="/{{.}}" alt="Author Image" class="img-circle headshot center"> {{ end }}
<p class="lead">
{{ with .Site.Params.description }} {{.}} {{ else }} Your site's description {{end}}
</p>
</div>
{{ partial "sidebar_menu.html" . }}
{{ partial "sidebar/menu.html" . }}
<p>
{{ partial "sidebar_social.html" . }}
{{ partial "sidebar/social.html" . }}
</p>
<p class="copyright">{{ with .Site.Params.copyright }}{{.|safeHTML}}{{ else }}&copy; {{ now.Format "2006"}} {{.Site.Params.author}}.
<a href="https://creativecommons.org/licenses/by/4.0">Some Rights Reserved</a>.<br/>Built with <a href="https://gohugo.io/">Hugo</a> &amp; <a href="https://github.com/htr3n/hyde-hyde">hyde-hyde</a>.{{end}}

View file

@ -1,19 +1,18 @@
<!-- sidebar start -->
<div>
<ul class="sidebar-nav">
{{ $currentPage := . }}
{{ range .Site.Menus.main -}}
{{- range .Site.Menus.main -}}
{{ if .HasChildren -}}
<li class="{{ if $currentPage.HasMenuCurrent "main" . }}active{{ end }}">
<a href="#">{{ .Pre }}<span>{{ .Name }}</span></a>
<ul class="sidebar-nav">
{{ range .Children -}}
{{- range .Children -}}
<li class="{{ if $currentPage.IsMenuCurrent "main" . }}active{{ end }}">
<a href="{{ .URL }}">{{ .Name | title }}</a>
</li>
{{- end -}}
</ul>
{{- else -}} <!-- No Children-->
{{- else -}}
<li>
<a href="{{.URL}}">{{ .Pre }} <span>{{ .Name | title }}</span></a>
</li>

View file

@ -1,38 +1,38 @@
<section class="row text-center">
{{ with .Site.Params.social.twitter }}
{{ with .Site.Params.social.twitter -}}
<a href="https://twitter.com/{{.}}"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.facebook }}
{{- end }}
{{ with .Site.Params.social.facebook -}}
&nbsp;<a href="https://facebook.com/{{.}}"><i class="fab fa-facebook-f"></i></a>
{{ end }}
{{ with .Site.Params.social.github }}
{{- end }}
{{ with .Site.Params.social.github -}}
&nbsp;<a href="https://github.com/{{.}}"><i class="fab fa-github fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.bitbucket }}
{{- end }}
{{ with .Site.Params.social.bitbucket -}}
&nbsp;<a href="https://bitbucket.org/{{.}}"><i class="fab fa-bitbucket fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.gitlab }}
{{- end }}
{{ with .Site.Params.social.gitlab -}}
&nbsp;<a href="https://gitlab.com/{{.}}"><i class="fab fa-gitlab fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.instagram }}
{{- end }}
{{ with .Site.Params.social.instagram -}}
&nbsp;<a href="https://instagram.com/{{.}}"><i class="fab fa-instagram fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.linkedin }}
{{- end }}
{{ with .Site.Params.social.linkedin -}}
&nbsp;<a href="https://linkedin.com/in/{{.}}"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.stackoverflow }}
{{- end }}
{{ with .Site.Params.social.stackoverflow -}}
&nbsp;<a href="https://stackoverflow.com/users/{{.}}"><i class="fab fa-stack-overflow fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{- end }}
{{ with .Site.Params.social.medium}}
&nbsp;<a href="https://medium.com/{{.}}"><i class="fab fa-medium fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.xing }}
{{- end }}
{{ with .Site.Params.social.xing -}}
&nbsp;<a href="https://www.xing.com/profile/{{.}}"><i class="fab fa-xing fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.keybase }}
{{- end }}
{{ with .Site.Params.social.keybase -}}
&nbsp;<a href="https://keybase.io/{{.}}"><i class="fab fa-keybase fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{ with .Site.Params.social.email }}
{{- end }}
{{ with .Site.Params.social.email -}}
&nbsp;<a href="mailto:{{.}}"><i class="fas fa-at fa-lg" aria-hidden="true"></i></a>
{{ end }}
{{- end }}
</section>