feat: add social icons and template bug fixes

This commit is contained in:
Vivek R 2019-04-20 00:22:50 +05:30
parent e9b2b8f64d
commit b89ed755ef
9 changed files with 102 additions and 15 deletions

View File

@ -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>

View File

@ -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>

View File

@ -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> &mdash;
@ -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>

View 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>

View File

@ -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">

View File

@ -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>

View File

@ -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

File diff suppressed because one or more lines are too long

0
static/js/main.js Normal file
View File