add dates to posts on collections w/ blog format

pull/190/head
Rob Loranger 5 years ago
parent 3759f16ed3
commit 9c3bee8a7d
No known key found for this signature in database
GPG Key ID: D6F1633A4F0903B8
  1. 2
      posts.go
  2. 14
      templates/chorus-collection-post.tmpl
  3. 24
      templates/collection-post.tmpl

@ -1380,12 +1380,14 @@ Are you sure it was ever here?`,
IsFound bool IsFound bool
IsAdmin bool IsAdmin bool
CanInvite bool CanInvite bool
ShowDates bool
}{ }{
PublicPost: p, PublicPost: p,
StaticPage: pageForReq(app, r), StaticPage: pageForReq(app, r),
IsOwner: cr.isCollOwner, IsOwner: cr.isCollOwner,
IsCustomDomain: cr.isCustomDomain, IsCustomDomain: cr.isCustomDomain,
IsFound: postFound, IsFound: postFound,
ShowDates: c.NewFormat().ShowDates(),
} }
tp.IsAdmin = u != nil && u.IsAdmin() tp.IsAdmin = u != nil && u.IsAdmin()
tp.CanInvite = canUserInvite(app.cfg, tp.IsAdmin) tp.CanInvite = canUserInvite(app.cfg, tp.IsAdmin)

@ -38,15 +38,15 @@ body footer {
body#post header { body#post header {
padding: 1em 1rem; padding: 1em 1rem;
} }
article time.dt-published { article time.dt {
display: block; display: block;
}
article time.dt.published {
color: #666; color: #666;
margin-bottom: 1em;
} }
body#post article h2#title{ body#post article h2#title{
margin-bottom: 0.5em; margin-bottom: 0.5em;
}
article time.dt-published {
margin-bottom: 1em;
} }
</style> </style>
@ -65,7 +65,11 @@ article time.dt-published {
{{template "user-navigation" .}} {{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> <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}}
{{if .ShowDates}}<time class="dt{{if .Title.String}} published{{end}}" datetime="{{.Created}}" pubdate itemprop="datePublished" content="{{.Created}}">{{.DisplayDate}}</time>{{end}}
<div class="e-content">{{.HTMLContent}}</div></article>
{{ if .Collection.ShowFooterBranding }} {{ if .Collection.ShowFooterBranding }}
<footer dir="ltr"> <footer dir="ltr">

@ -32,7 +32,22 @@
<meta property="article:published_time" content="{{.Created8601}}"> <meta property="article:published_time" content="{{.Created8601}}">
{{ end }} {{ end }}
{{if .Collection.StyleSheet}}<style type="text/css">{{.Collection.StyleSheetDisplay}}</style>{{end}} {{if .Collection.StyleSheet}}<style type="text/css">{{.Collection.StyleSheetDisplay}}</style>{{end}}
{{/*below css duplicated in part in chorus-collection-post.tmpl*/}}
<style type="text/css">
body#post header {
padding: 1em 1rem;
}
article time.dt {
display: block;
}
article time.dt.published {
color: #666;
margin-bottom: 1em;
}
body#post article h2#title{
margin-bottom: 0.5em;
}
</style>
{{if .Collection.RenderMathJax}} {{if .Collection.RenderMathJax}}
<!-- Add mathjax logic --> <!-- Add mathjax logic -->
{{template "mathjax" . }} {{template "mathjax" . }}
@ -59,7 +74,12 @@
</nav> </nav>
</header> </header>
<article id="post-body" class="{{.Font}} h-entry {{if not .IsFound}}error-page{{end}}">{{if .IsScheduled}}<p class="badge">Scheduled</p>{{end}}{{if .Title.String}}<h2 id="title" class="p-name">{{.FormattedDisplayTitle}}</h2>{{end}}<div class="e-content">{{.HTMLContent}}</div></article> <article id="post-body" class="{{.Font}} h-entry {{if not .IsFound}}error-page{{end}}">
{{if .IsScheduled}}<p class="badge">Scheduled</p>{{end}}
{{if .Title.String}}<h2 id="title" class="p-name">{{.FormattedDisplayTitle}}</h2>{{end}}
{{if .ShowDates}}<time class="dt{{if .Title.String}} published{{end}}" datetime="{{.Created}}" pubdate itemprop="datePublished" content="{{.Created}}">{{.DisplayDate}}</time>{{end}}
<div class="e-content">{{.HTMLContent}}</div>
</article>
{{ if .Collection.ShowFooterBranding }} {{ if .Collection.ShowFooterBranding }}
<footer dir="ltr"><hr><nav><p style="font-size: 0.9em">{{localhtml "published with write.as" .Language.String}}</p></nav></footer> <footer dir="ltr"><hr><nav><p style="font-size: 0.9em">{{localhtml "published with write.as" .Language.String}}</p></nav></footer>

Loading…
Cancel
Save