feat: add social icons and template bug fixes
This commit is contained in:
parent
e9b2b8f64d
commit
b89ed755ef
@ -13,11 +13,14 @@
|
||||
{{ end }}
|
||||
|
||||
<ul class="posts">
|
||||
{{- range first .Site.Params.SidebarRecentLimit .Data.Pages -}}
|
||||
{{- range .Data.Pages -}}
|
||||
{{- if (in (.Site.Params.excludedTypes | default (slice "page")) .Type) -}}
|
||||
{{- else -}}
|
||||
<li class="post">
|
||||
<a href="{{ .RelPermalink }}">{{.Title}}</a> <span class="meta">{{ dateFormat "Jan 2, 2006" .Date }}</span>
|
||||
</li>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
@ -14,9 +14,19 @@
|
||||
{{ .Content }}
|
||||
</div>
|
||||
|
||||
{{ partial "disqus.html" . }}
|
||||
</div>
|
||||
{{- $.Scratch.Set "isDisqus" true -}}
|
||||
{{- if and (isset .Params "disqus") (eq .Params.disabledisqus false) -}}
|
||||
{{- $.Scratch.Set "isDisqus" false -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if and (isset .Params "type") (in (.Site.Params.disableDisqusTypes | default (slice "page")) .Params.type) -}}
|
||||
{{- $.Scratch.Set "isDisqus" false -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- if eq ($.Scratch.Get "isDisqus") true -}}
|
||||
{{- partial "disqus.html" . -}}
|
||||
{{- end -}}
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
</body>
|
||||
</html>
|
||||
|
@ -10,7 +10,11 @@
|
||||
Recent posts
|
||||
</h2>
|
||||
<div class="posts">
|
||||
{{- range first .Site.Params.SidebarRecentLimit .Data.Pages -}}
|
||||
{{- $.Scratch.Set "counter" 0 -}}
|
||||
{{- range .Data.Pages -}}
|
||||
{{- if (in (.Site.Params.excludedTypes | default (slice "page")) .Type) -}}
|
||||
{{- else -}}
|
||||
{{- if lt ($.Scratch.Get "counter") (.Site.Params.RecentPostsCount | default 10) -}}
|
||||
<div class="post">
|
||||
<div class="meta">{{ dateFormat "Jan 2, 2006" .Date }}</div>
|
||||
<a class="title" href="{{ .RelPermalink }}">{{.Title}}</a> —
|
||||
@ -24,6 +28,9 @@
|
||||
{{ end }}
|
||||
</span>
|
||||
</div>
|
||||
{{- $.Scratch.Set "counter" (add ($.Scratch.Get "counter") 1) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<a href="/posts">All articles →</a>
|
||||
@ -32,5 +39,8 @@
|
||||
</div>
|
||||
{{ partial "footer.html" . }}
|
||||
{{ template "_internal/google_analytics_async.html" . }}
|
||||
{{- with .Site.Params.Social -}}
|
||||
<script>feather.replace()</script>
|
||||
{{- end -}}
|
||||
</body>
|
||||
</html>
|
||||
|
17
layouts/partials/disqus.html
Normal file
17
layouts/partials/disqus.html
Normal file
@ -0,0 +1,17 @@
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
// Don't ever inject Disqus on localhost--it creates unwanted
|
||||
// discussions from 'localhost:1313' on your Disqus account...
|
||||
if (window.location.hostname == "localhost")
|
||||
return;
|
||||
|
||||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
|
||||
var disqus_shortname = '{{ .Site.DisqusShortname }}';
|
||||
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by
|
||||
Disqus.</a></noscript>
|
||||
<a href="http://disqus.com/" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
|
@ -1,6 +1,17 @@
|
||||
<div class="header">
|
||||
<h1>{{ .Site.Title }}</h1>
|
||||
<h2>{{ .Site.Params.TitleTag | markdownify }}</h2>
|
||||
<h1 class="site-title">{{ .Site.Title }}</h1>
|
||||
<div class="site-description">
|
||||
{{- if isset .Site.Params "subtitle" -}}
|
||||
<h2>{{ .Site.Params.Subtitle | markdownify }}</h2>
|
||||
{{- end -}}
|
||||
<nav class="nav social">
|
||||
<ul class="flat">
|
||||
{{- range $index, $key := .Site.Params.Social -}}
|
||||
<a href="{{ $key.link }}" title="{{ $key.name }}"><i data-feather="{{ $key.icon }}"></i></a>
|
||||
{{- end -}}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<nav class="nav">
|
||||
<ul class="flat">
|
||||
|
@ -1,22 +1,26 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
{{- $title := ( .Title ) -}}
|
||||
{{- $siteTitle := ( .Site.Title ) -}}
|
||||
|
||||
{{- if .IsHome -}}
|
||||
<title>{{ $siteTitle }}</title>
|
||||
<title>{{ $siteTitle }} {{- if isset .Site.Params "subtitle" -}} - {{ .Site.Params.Subtitle }}{{- end -}} </title>
|
||||
{{- else -}}
|
||||
<title>{{ $title }} - {{ $siteTitle }}</title>
|
||||
<title>{{ $title }} - {{ $siteTitle }}</title>
|
||||
{{- end -}}
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{{ template "_internal/opengraph.html" . }}
|
||||
{{ template "_internal/twitter_cards.html" . }}
|
||||
|
||||
{{- template "_internal/opengraph.html" . -}}
|
||||
{{- template "_internal/twitter_cards.html" . -}}
|
||||
<link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,300italic,400italic|Raleway:500,100,300" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/normalize.css" />
|
||||
<link rel="stylesheet" type="text/css" media="screen" href="/css/main.css" />
|
||||
<script src="main.js"></script>
|
||||
|
||||
{{- if and (isset .Site.Params "social") (isset .Site.Params "feathericonscdn") (eq .Site.Params.featherIconsCDN true) -}}
|
||||
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
||||
{{- else if (isset .Site.Params "social") -}}
|
||||
<script src="/js/feather.min.js"></script>
|
||||
{{- end -}}
|
||||
<script src="/js/main.js"></script>
|
||||
</head>
|
||||
|
@ -122,7 +122,7 @@ ul.flat {
|
||||
ul.flat li {
|
||||
display: inline-block;
|
||||
list-style: none;
|
||||
margin-left: 0
|
||||
margin-left: 0
|
||||
}
|
||||
|
||||
.prevent-collapse {
|
||||
@ -141,6 +141,10 @@ ul {
|
||||
list-style: disc inside
|
||||
}
|
||||
|
||||
.post ul li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.highlight pre {
|
||||
margin-bottom: 0;
|
||||
margin-top: 0;
|
||||
@ -201,6 +205,21 @@ ul {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.header .site-description {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.header .site-description nav {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.header .site-description nav ul svg {
|
||||
max-height: 15px;
|
||||
}
|
||||
|
||||
.section .section-header {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
|
13
static/js/feather.min.js
vendored
Normal file
13
static/js/feather.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
0
static/js/main.js
Normal file
0
static/js/main.js
Normal file
Loading…
Reference in New Issue
Block a user