2019-08-07 13:00:16 +00:00
|
|
|
{{define "post"}}<!DOCTYPE HTML>
|
|
|
|
<html {{if .Language.Valid}}lang="{{.Language.String}}"{{end}} dir="{{.Direction}}">
|
|
|
|
<head prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article#">
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
|
|
<title>{{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{.Collection.DisplayTitle}}</title>
|
|
|
|
|
|
|
|
<link rel="stylesheet" type="text/css" href="/css/write.css" />
|
|
|
|
<link rel="shortcut icon" href="/favicon.ico" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
2019-11-09 19:41:39 +00:00
|
|
|
<link rel="canonical" href="{{.CanonicalURL .Host}}" />
|
2019-08-07 13:00:16 +00:00
|
|
|
<meta name="generator" content="WriteFreely">
|
|
|
|
<meta name="title" content="{{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{if .Collection.Title}}{{.Collection.Title}}{{else}}{{.Collection.Alias}}{{end}}">
|
|
|
|
<meta name="description" content="{{.Summary}}">
|
|
|
|
{{if gt .Views 1}}<meta name="twitter:label1" value="Views">
|
|
|
|
<meta name="twitter:data1" value="{{largeNumFmt .Views}}">{{end}}
|
|
|
|
<meta name="author" content="{{.Collection.Title}}" />
|
|
|
|
<meta itemprop="description" content="{{.Summary}}">
|
|
|
|
<meta itemprop="datePublished" content="{{.CreatedDate}}" />
|
|
|
|
<meta name="twitter:card" content="summary">
|
|
|
|
<meta name="twitter:description" content="{{.Summary}}">
|
|
|
|
<meta name="twitter:title" content="{{.PlainDisplayTitle}} {{localhtml "title dash" .Language.String}} {{if .Collection.Title}}{{.Collection.Title}}{{else}}{{.Collection.Alias}}{{end}}">
|
|
|
|
{{if gt (len .Images) 0}}<meta name="twitter:image" content="{{index .Images 0}}">{{else}}<meta name="twitter:image" content="{{.Collection.AvatarURL}}">{{end}}
|
|
|
|
<meta property="og:title" content="{{.PlainDisplayTitle}}" />
|
|
|
|
<meta property="og:description" content="{{.Summary}}" />
|
|
|
|
<meta property="og:site_name" content="{{.Collection.DisplayTitle}}" />
|
|
|
|
<meta property="og:type" content="article" />
|
2019-11-09 19:41:39 +00:00
|
|
|
<meta property="og:url" content="{{.CanonicalURL .Host}}" />
|
2019-08-07 13:00:16 +00:00
|
|
|
<meta property="og:updated_time" content="{{.Created8601}}" />
|
|
|
|
{{range .Images}}<meta property="og:image" content="{{.}}" />{{else}}<meta property="og:image" content="{{.Collection.AvatarURL}}">{{end}}
|
|
|
|
<meta property="article:published_time" content="{{.Created8601}}">
|
|
|
|
{{if .Collection.StyleSheet}}<style type="text/css">{{.Collection.StyleSheetDisplay}}</style>{{end}}
|
|
|
|
<style type="text/css">
|
|
|
|
body footer {
|
|
|
|
max-width: 40rem;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
|
|
|
body#post header {
|
|
|
|
padding: 1em 1rem;
|
|
|
|
}
|
|
|
|
article time.dt-published {
|
|
|
|
display: block;
|
|
|
|
color: #666;
|
|
|
|
}
|
|
|
|
body#post article h2#title{
|
|
|
|
margin-bottom: 0.5em;
|
|
|
|
}
|
|
|
|
article time.dt-published {
|
|
|
|
margin-bottom: 1em;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
|
|
|
{{if .Collection.RenderMathJax}}
|
|
|
|
<!-- Add mathjax logic -->
|
|
|
|
{{template "mathjax" . }}
|
|
|
|
{{end}}
|
|
|
|
|
|
|
|
<!-- Add highlighting logic -->
|
|
|
|
{{template "highlighting" .}}
|
|
|
|
|
|
|
|
</head>
|
|
|
|
<body id="post">
|
|
|
|
|
|
|
|
<div id="overlay"></div>
|
|
|
|
|
|
|
|
{{template "user-navigation" .}}
|
|
|
|
|
2019-10-25 19:04:24 +00:00
|
|
|
{{if .Suspended}}
|
|
|
|
{{template "user-suspended"}}
|
|
|
|
{{end}}
|
2019-08-07 13:00:16 +00:00
|
|
|
<article id="post-body" class="{{.Font}} h-entry">{{if .IsScheduled}}<p class="badge">Scheduled</p>{{end}}{{if .Title.String}}<h2 id="title" class="p-name">{{.FormattedDisplayTitle}}</h2>{{end}}{{/* TODO: check format: if .Collection.Format.ShowDates*/}}<time class="dt-published" datetime="{{.Created}}" pubdate itemprop="datePublished" content="{{.Created}}">{{.DisplayDate}}</time><div class="e-content">{{.HTMLContent}}</div></article>
|
|
|
|
|
|
|
|
{{ if .Collection.ShowFooterBranding }}
|
|
|
|
<footer dir="ltr">
|
|
|
|
<p style="text-align: left">Published by <a rel="author" href="{{if .IsTopLevel}}/{{else}}/{{.Collection.Alias}}/{{end}}" class="h-card p-author">{{.Collection.DisplayTitle}}</a>
|
|
|
|
{{ if .IsOwner }} · <span class="views" dir="ltr"><strong>{{largeNumFmt .Views}}</strong> {{pluralize "view" "views" .Views}}</span>
|
|
|
|
· <a class="xtra-feature" href="/{{if not .SingleUser}}{{.Collection.Alias}}/{{end}}{{.Slug.String}}/edit" dir="{{.Direction}}">Edit</a>
|
|
|
|
{{if .IsPinned}} · <a class="xtra-feature unpin" href="/{{.Collection.Alias}}/{{.Slug.String}}/unpin" dir="{{.Direction}}" onclick="unpinPost(event, '{{.ID}}')">Unpin</a>{{end}}
|
|
|
|
{{ end }}
|
|
|
|
</p>
|
|
|
|
<nav>
|
|
|
|
{{if .PinnedPosts}}
|
2019-11-11 23:03:00 +00:00
|
|
|
{{range .PinnedPosts}}<a class="pinned{{if eq .Slug.String $.Slug.String}} selected{{end}}" href="{{if not $.SingleUser}}/{{$.Collection.Alias}}/{{.Slug.String}}{{else}}{{.CanonicalURL $.Host}}{{end}}">{{.PlainDisplayTitle}}</a>{{end}}
|
2019-08-07 13:00:16 +00:00
|
|
|
{{end}}
|
|
|
|
</nav>
|
|
|
|
<hr>
|
|
|
|
<nav><p style="font-size: 0.9em">{{localhtml "published with write.as" .Language.String}}</p></nav>
|
|
|
|
</footer>
|
|
|
|
{{ end }}
|
|
|
|
</body>
|
|
|
|
|
|
|
|
{{if .Collection.CanShowScript}}
|
|
|
|
{{range .Collection.ExternalScripts}}<script type="text/javascript" src="{{.}}" async></script>{{end}}
|
|
|
|
{{if .Collection.Script}}<script type="text/javascript">{{.Collection.ScriptDisplay}}</script>{{end}}
|
|
|
|
{{end}}
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
var pinning = false;
|
|
|
|
function unpinPost(e, postID) {
|
|
|
|
e.preventDefault();
|
|
|
|
if (pinning) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pinning = true;
|
|
|
|
|
2019-09-03 21:40:02 +00:00
|
|
|
var $footer = document.getElementsByTagName('footer')[0];
|
2019-08-07 13:00:16 +00:00
|
|
|
var callback = function() {
|
|
|
|
// Hide current page
|
2019-09-03 21:40:02 +00:00
|
|
|
var $pinnedNavLink = $footer.getElementsByTagName('nav')[0].querySelector('.pinned.selected');
|
2019-08-07 13:00:16 +00:00
|
|
|
$pinnedNavLink.style.display = 'none';
|
|
|
|
};
|
|
|
|
|
2019-09-03 21:40:02 +00:00
|
|
|
var $pinBtn = $footer.getElementsByClassName('unpin')[0];
|
2019-08-07 13:00:16 +00:00
|
|
|
$pinBtn.innerHTML = '...';
|
|
|
|
|
|
|
|
var http = new XMLHttpRequest();
|
|
|
|
var url = "/api/collections/{{.Collection.Alias}}/unpin";
|
|
|
|
var params = [ { "id": postID } ];
|
|
|
|
http.open("POST", url, true);
|
|
|
|
http.setRequestHeader("Content-type", "application/json");
|
|
|
|
http.onreadystatechange = function() {
|
|
|
|
if (http.readyState == 4) {
|
|
|
|
pinning = false;
|
|
|
|
if (http.status == 200) {
|
|
|
|
callback();
|
|
|
|
$pinBtn.style.display = 'none';
|
|
|
|
$pinBtn.innerHTML = 'Pin';
|
|
|
|
} else if (http.status == 409) {
|
|
|
|
$pinBtn.innerHTML = 'Unpin';
|
|
|
|
} else {
|
|
|
|
$pinBtn.innerHTML = 'Unpin';
|
|
|
|
alert("Failed to unpin." + (http.status>=500?" Please try again.":""));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
http.send(JSON.stringify(params));
|
|
|
|
};
|
|
|
|
|
|
|
|
try { // Fonts
|
|
|
|
WebFontConfig = {
|
|
|
|
custom: { families: [ 'Lora:400,700:latin', 'Open+Sans:400,700:latin' ], urls: [ '/css/fonts.css' ] }
|
|
|
|
};
|
|
|
|
(function() {
|
|
|
|
var wf = document.createElement('script');
|
|
|
|
wf.src = '/js/webfont.js';
|
|
|
|
wf.type = 'text/javascript';
|
|
|
|
wf.async = 'true';
|
|
|
|
var s = document.getElementsByTagName('script')[0];
|
|
|
|
s.parentNode.insertBefore(wf, s);
|
|
|
|
})();
|
|
|
|
} catch (e) { /* ¯\_(ツ)_/¯ */ }
|
|
|
|
</script>
|
|
|
|
</html>{{end}}
|