Skip to content

Commit

Permalink
Temp layout fix while waiting for gohugoio/hugo#2995
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriid committed Mar 9, 2017
1 parent eacbb47 commit d882a15
Show file tree
Hide file tree
Showing 19 changed files with 327 additions and 1 deletion.
2 changes: 1 addition & 1 deletion deploy.sh
Expand Up @@ -4,7 +4,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
echo "Running in $DIR"

echo "::: Building site" && \
hugo --theme=freja -v && \
~/.go/bin/hugo --theme=freja -v && \
echo "::: Site built" && \
echo "::: Remove old social cards" && \
rm -rf $DIR/public/assets/img/cards && \
Expand Down
130 changes: 130 additions & 0 deletions layouts/_default/baseof.html
@@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="{{.Site.LanguageCode}}">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
{{ .Hugo.Generator }}

<meta property="og:title" content="{{ if ne .URL "/" }} {{ .Title }} | {{ end }} {{ .Site.Title }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />
<meta property="og:url" content="{{ .Permalink }}" />

{{ if .IsPage }}
<meta property="og:type" content="article" />
<meta property="og:article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" | safeHTML }}" />
{{ range .Params.tags }}<meta property="og:article:tag" content="{{ . }}" />
{{ end }}

<meta name="twitter:card" content="summary_large_image" />
{{ with .Site.Params.twitter }}
<meta name="twitter:site" content="@{{ . }}" />
<meta name="twitter:creator" content="@{{ . }}" />
{{ end }}
<meta name="twitter:title" content="{{ .Title }}" />
<meta name="twitter:url" content="{{ .Permalink }}" />
<meta name="twitter:image" content="{{ .Site.BaseURL }}assets/img/cards/{{ first 6 .UniqueID }}/{{ after 6 .UniqueID}}.png">
<meta name="twitter:image:alt" content="{{ .Title }}">
<meta property="og:image" content="{{ .Site.BaseURL }}assets/img/cards/{{ first 6 .UniqueID }}/{{ after 6 .UniqueID}}.png"/>
{{ else }}
<meta property="og:type" content="website" />
{{ end }}

{{ if .Params.summary }}
<meta name="description" content="{{ .Params.summary }}" />
<meta property="og:description" content="{{ .Params.summary }}" />
<meta name="twitter:description" content="{{ .Params.summary }}" />
{{ else }}
<meta name="description" content="{{ .Site.Params.description }}" />
<meta property="og:description" content="{{ .Site.Params.description }}" />
<meta name="twitter:description" content="{{ .Description }}" />
{{ end }}

{{ if ne .URL "/" }}
<link href="{{ .Site.BaseURL }}index.xml" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}" />
{{ end }}

{{if .IsNode}}
<link href="{{.RSSLink}}" rel="alternate" type="application/rss+xml" title="{{ if ne .URL "/" }}{{ .Title }} | {{ end }}{{ .Site.Title }}" />
{{end}}
<link rel="canonical" href="{{ .Permalink }}" />

{{ if .IsPage }}{{ with .Site.Params.gplus }}
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "Article",
"headline": "{{ .Title }}",
"author": {
"@type": "Person",
"name": "http://profiles.google.com/{{ .Site.Params.gplus }}?rel=author"
},
"datePublished": "{{ .Date.Format "2006-01-02" }}",
"description": "{{ .Description }}",
"wordCount": {{ .WordCount }}
}

</script>
{{ end }}{{ end }}

{{ $doc := . }}
{{ with .Site.Params.disqus }}
<script type="text/javascript">
var disqus_shortname = '{{ . }}';
var disqus_identifier = '{{if isset $doc.Params "disqus_identifier" }}{{ index $doc.Params "disqus_identifier" }}{{ else }}{{ $doc.Permalink }}{{end}}';
var disqus_title = '{{if isset $doc.Params "disqus_title" }}{{ index $doc.Params "disqus_title" }}{{ else }}{{ $doc.Title }}{{end}}';
var disqus_url = '{{if isset $doc.Params "disqus_url" }}{{ index $doc.Params "disqus_url" | html }}{{ else }}{{ $doc.Permalink }}{{end}}';
</script>
{{ end }}

<link href="https://fonts.googleapis.com/css?family=Merriweather:400,400i,700,700i&subset=cyrillic,latin-ext"
rel="stylesheet">
<link rel="stylesheet" href="{{ .Site.BaseURL }}assets/css/normalize.css?{{ .Now.Unix }}">
<link rel="stylesheet" href="{{ .Site.BaseURL }}assets/css/freja.css?{{ .Now.Unix }}">

<title>{{ block "title" . }}
{{ with .Title }}{{ . }} | {{ end }}{{ .Site.Title }}
{{ end }}</title>

</head>
<body>
<section role="navigation" class="main-nav">
<figure class="logo" role="banner"><a href="{{ .Site.BaseURL }}" title={{ .Site.Title }}><img src="{{ .Site.BaseURL }}assets/img/logo.svg"
alt="{{ .Site.Title}}"
/></a>
</figure>
<nav role="navigation">
<ul>
<li><a href="{{ .Site.BaseURL }}">Home</a></li>
<li><a href="https://github.com/dmitriid">GitHub</a></li>
<li><a href="http://old.dmitriid.com/">Old site</a></li>
</ul>
</nav>
</section>
<main>
{{ block "main" . }}
{{ end }}
</main>
<footer>
<p>
Copyright © 2016 Dmitrii Dimandt
</p>
</footer>
<script>
(function(i, s, o, g, r, a, m){
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function(){
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'ga');

ga('create', {{ .Site.Params.analytics }}, 'auto');
ga('send', 'pageview');

</script>
</body>
</html>
36 changes: 36 additions & 0 deletions layouts/_default/list.html
@@ -0,0 +1,36 @@
{{ define "main" }}
{{ range .Data.Pages }}

{{ if (and (not ( eq .Section "gen" )) (not ( eq .Section "notes" ))) }}

<article>
<header class="header-levelh1">
<a href="{{.RelPermalink}}"
title="{{ .Title }}">
{{- .Title -}}
</a><small>{{ .Date.Format "2006-01-02" }}</small>
</header>
{{ with .Params.summary | default .Summary | plainify }}
<p>{{ . }}</p>
{{ end }}
<div class="post-post">
<p class="read-more">
<a href="{{.RelPermalink}}" role="link" title="Read more {{ .Title }}"
class="read-more">Read more</a>
<span class="read-count">
<small class="word-count">
{{ .WordCount }} words / {{ .ReadingTime }} minute{{ if gt .ReadingTime 1}}s{{ end }}
</small>
</span>
</p>
<p class="tags">
{{ range .Params.tags }}
<a href="{{ "/tags/" | relURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
</p>
</div>
</article>
<hr />
{{ end }}
{{ end }}
{{ end }}
58 changes: 58 additions & 0 deletions layouts/_default/single.html
@@ -0,0 +1,58 @@
{{ define "title" }}
{{ .Title }} | {{ .Site.Title }}
{{ end }}
{{ define "main" }}
<article>
{{ if (isset .Params "banner") }}
<div class="banner">
<img src="{{ .Params.banner }}" alt="{{ .Title }}" />
<header class="header-levelh1"><span>{{ .Title }}</span></header>
</div>
{{ else }}
<header class="header-levelh1">{{ .Title }}</header>
{{ end }}
<div class="post-meta">
<div class="table-of-contents">
<p>Table of Contents</p>
{{ .TableOfContents }}
<small class="word-count">{{ .WordCount }} words / {{ .ReadingTime }} minute{{ if gt .ReadingTime 1}}s{{ end }}</small>
</div>
<div class="meta">
<p>Published</p>
<p class="meta-data">{{ .Date.Format "2006-01-02" }}</p>
{{ if not (eq .Lastmod .Date ) }}
<p>Modified</p>
<p class="meta-data">{{ .Lastmod.Format "2006-01-02" }}</p>
{{ end }}
{{if isset .Params "tags" }}
<p>Tags</p>
<p class="tags meta-data">
{{ range .Params.tags }}
<a href="{{ "/tags/" | relURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
</p>
{{ end }}
</div>
</div>
{{ .Content }}
</article>
<hr/>
<div id="disqus_thread"></div>
<script>

var disqus_config = function(){
this.page.url = '{{ .Permalink }}';
this.page.identifier = '{{ .UniqueID }}';
this.page.title = '{{ .Title }}';
};

(function(){ // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = '//dmitriidcom.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments
powered by Disqus.</a></noscript>
{{ end }}
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions layouts/shortcodes/banner.html
@@ -0,0 +1,4 @@
<div class="banner">
<img src="{{ .Get "src" }}" alt="{{ .Get "title" }}" />
<header class="header-levelh1"><span>{{ .Get "title" }}</span></header>
</div>
14 changes: 14 additions & 0 deletions layouts/shortcodes/fullimage.html
@@ -0,0 +1,14 @@
{{- $author := .Get "author" -}}
{{- $description := .Get "description" -}}
{{- $src := .Get "src" -}}
{{- $link := .Get "link" -}}
<figure class="fullimage">
<img src="{{ $src }}"{{ with $description }} alt="{{ . }}"{{ end }} />
{{- if $description | or $author -}}
<figcaption>
<cite>
{{ with $author }}{{ if $link }}<a href="{{ $link }}">{{ end }}{{ . }}{{ if $link }}</a>{{ end }} {{ end }}{{ with $description }}<em>{{ . }}</em>{{ end }}
</cite>
</figcaption>
{{- end -}}
</figure>
3 changes: 3 additions & 0 deletions layouts/shortcodes/gallery.html
@@ -0,0 +1,3 @@
<div class="gallery">
{{ .Inner }}
</div>
18 changes: 18 additions & 0 deletions layouts/shortcodes/image.html
@@ -0,0 +1,18 @@
{{- $author := .Get "author" -}}
{{- $description := .Get "description" -}}
{{- $src := .Get "src" -}}
{{- $link := .Get "link" -}}
{{- $inner := .Inner -}}
<figure class="image">
<div class="wrapper">
<img src="{{ $src }}"{{ with $description }} alt="{{ . }}"{{ end }} />
</div>
{{- if $description | or $author | or (gt (len $inner) 0) -}}
<figcaption>
<cite>
{{ with $author }}{{ if $link }}<a href="{{ $link }}">{{ end }}{{ . }}{{ if $link }}</a>{{ end }} {{ end }}{{ with $description }}<em>{{ . }}</em>{{ end }}
{{ if gt (len .Inner) 0 }}{{ if $description | or $author }}<br />{{ end }}{{ .Inner }}{{ end }}
</cite>
</figcaption>
{{- end -}}
</figure>
18 changes: 18 additions & 0 deletions layouts/shortcodes/inlineimage.html
@@ -0,0 +1,18 @@
{{- $author := .Get "author" -}}
{{- $description := .Get "description" -}}
{{- $src := .Get "src" -}}
{{- $link := .Get "link" -}}
{{- $inner := .Inner -}}
<figure class="inlineimage">
<div class="wrapper">
<img src="{{ $src }}"{{ with $description }} alt="{{ . }}"{{ end }} />
</div>
{{- if $description | or $author | or (gt (len $inner) 0) -}}
<figcaption>
<cite>
{{ with $author }}{{ if $link }}<a href="{{ $link }}">{{ end }}{{ . }}{{ if $link }}</a>{{ end }} {{ end }}{{ with $description }}<em>{{ . }}</em>{{ end }}
{{ if gt (len .Inner) 0 }}{{ if $description | or $author }}<br />{{ end }}{{ .Inner }}{{ end }}
</cite>
</figcaption>
{{- end -}}
</figure>
11 changes: 11 additions & 0 deletions layouts/shortcodes/quote.html
@@ -0,0 +1,11 @@
<figure class="quote">
<blockquote cite="">
{{ .Inner }}
</blockquote>

<figcaption>
<cite>
<small>{{ with .Get "link" }}<a href="{{ . }}">{{ end }}{{ with .Get "author" }}{{ . }}{{ end }}{{ with .Get "link" }}</a>{{ end }}</small>
</cite>
</figcaption>
</figure>
16 changes: 16 additions & 0 deletions layouts/shortcodes/socialcards.html
@@ -0,0 +1,16 @@
{{ range .Site.Pages }}
{{ if .UniqueID }}
[{{.UniqueID}}]

title = {{ .Title | plainify | jsonify }}

{{ if (isset .Params "banner") }}
image = "{{ .Params.banner }}"
{{ end }}

{{ if (isset .Params "summary") }}summary = {{ .Params.summary | plainify | jsonify}}{{ end }}

out = {{ first 6 .UniqueID }}/{{ after 6 .UniqueID}}.png

{{ end }}
{{ end }}
1 change: 1 addition & 0 deletions layouts/shortcodes/square.html
@@ -0,0 +1 @@
<span style="display: inline-block; background-color: {{ .Get "color" }}; width: {{ .Get "size" }}; height: {{ .Get "size" }}" > </span>
4 changes: 4 additions & 0 deletions layouts/shortcodes/video.html
@@ -0,0 +1,4 @@
<div class="video">{{- if .Get "youtube" -}}
<iframe src="https://www.youtube.com/embed/{{ .Get "youtube" }}"
frameborder="0" allowfullscreen></iframe>{{- end -}}
</div>
3 changes: 3 additions & 0 deletions themes/freja/layouts/gen/baseof.html
@@ -0,0 +1,3 @@
{{ block "main" . }}

{{ end }}
7 changes: 7 additions & 0 deletions themes/freja/layouts/gen/list.html
@@ -0,0 +1,7 @@
{{ define "main" }}
{{ range .Data.Pages }}

{{ .Content }}

{{ end }}
{{ end }}
3 changes: 3 additions & 0 deletions themes/freja/layouts/gen/single.html
@@ -0,0 +1,3 @@
{{ define "main" }}
{{ .Content }}
{{ end }}

0 comments on commit d882a15

Please sign in to comment.