Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add site-wide navigation on colls when chorus = true
This adds a new config value: `chorus` that signifies an instance is more about the Reader view than individual blogs / writers. When enabled, user navigation will show on all pages, including About, Reader, and Privacy (ref T680). It also uses different collection templates that keep the instance-wide navigation at the top of the page, instead of the author's name -- again, branded more for the collective than the individual. Ref T681
- Loading branch information
Showing
13 changed files
with
464 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
{{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" /> | ||
<link rel="canonical" href="{{.CanonicalURL}}" /> | ||
<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" /> | ||
<meta property="og:url" content="{{.CanonicalURL}}" /> | ||
<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" .}} | ||
|
||
<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}} | ||
{{range .PinnedPosts}}<a class="pinned{{if eq .Slug.String $.Slug.String}} selected{{end}}" href="{{if not $.SingleUser}}/{{$.Collection.Alias}}/{{.Slug.String}}{{else}}{{.CanonicalURL}}{{end}}">{{.PlainDisplayTitle}}</a>{{end}} | ||
{{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; | ||
|
||
var $header = document.getElementsByTagName('header')[0]; | ||
var callback = function() { | ||
// Hide current page | ||
var $pinnedNavLink = $header.getElementsByTagName('nav')[0].querySelector('.pinned.selected'); | ||
$pinnedNavLink.style.display = 'none'; | ||
}; | ||
|
||
var $pinBtn = $header.getElementsByClassName('unpin')[0]; | ||
$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}} |
Oops, something went wrong.