-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpost.cshtml
89 lines (81 loc) · 2.79 KB
/
post.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
@using Kentico.Kontent.Statiq.Memoirs.Models
@using System.Globalization
@model Kentico.Kontent.Statiq.Memoirs.Models.Post
@{
var site = ViewData["SiteMetaData"] as SiteSettings;
var author = Model.Author.OfType<Author>().FirstOrDefault();
ViewData["Author"] = author; }
<div class="entry-header">
<!-- Post Title -->
<h1 class="posttitle">@Model.Title</h1>
<!-- Author & Date Box -->
@if (author != null)
{
<div class="d-flex align-items-center mt-4">
<div>
@if (author.AvatarImage?.Any() ?? false)
{
<img class="author-thumb" src="@author.AvatarImage.First().Url?w=250&h=250" alt="@author.Name"> }
else
{
<img class="author-thumb" src="https://www.gravatar.com/avatar/@author.Gravatar?s=250&d=mm&r=x" alt="@author.Name">}
</div>
<div>
Written by <span class="text-dark">@author.Name</span> on
<span class="post-date"><time class="post-date" datetime="@Model.PostDate?.ToString("dd-MM-yyyy")">@Model.PostDate?.ToString("d MMMM yyyy")</time></span>
</div>
</div>}
</div>
<!-- Featured Image -->
<partial name="Shared/_featured-image" model="Model.Image" />
<!-- Content -->
<partial name="Shared/_article" model="Model"/>
<!-- Rating -->
@if (Model.Rating.HasValue)
{
<div class="rating mt-4 mb-4 d-flex align-items-center">
<strong class="mr-1">Rating:</strong> <partial name="Shared/star_rating" model="Model.Rating.Value" />
</div>}
<!-- Author Box if enabled from _config.yml -->
<partial name="Shared/author-box" model="author" />
<!-- Comments if not disabled with comments: false -->
<partial name="Shared/comments" model="Model"/>
<!-- Share -->
<partial name="Shared/share" model="Model" />
<!-- Related Post -->
<partial name="Shared/related-posts" model="Model" />
<!-- Review with LD-JSON, adapt it for your needs if you like, but make sure you test the generated HTML source code first:
https://search.google.com/structured-data/testing-tool/u/0/
================================================== -->
@if (Model.Rating.HasValue){
<script type="application/ld+json">
{
"context": "http://schema.org/",
"type": "Review",
"itemReviewed": {
"type": "Thing",
"name": "@Model.Title"
},
"author": {
"type": "Person",
"name": "@author.Name"
},
"datePublished": "@Model.PostDate?.ToString("yyyy-MM-dd")",
"reviewRating": {
"type": "Rating",
"ratingValue": "@Model.Rating?.ToString("N2", CultureInfo.InvariantCulture)",
"bestRating": "5"
}
}
</script>
}
@section footerScripts{
@if (Model.Comments())
{
if (string.IsNullOrWhiteSpace(site.DisqusId))
{
throw new InvalidOperationException("Please configure the DisqusId in the site setting before enabling comments.");
}
<script id="dsq-count-scr" src="//@(site.DisqusId).disqus.com/count.js"></script>
}
}