-
Notifications
You must be signed in to change notification settings - Fork 518
/
related.cshtml
78 lines (73 loc) · 2.86 KB
/
related.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
@model PostModel
@inject IStringLocalizer<Resource> _localizer
<!--
TODO:
List of related posts.
Custom Fields:
- on or off
- Title (Related Posts)
- How many items
-->
@if (Model.PostSlug.Related.Any())
{
<section class="related">
<header class="related-header">
<h3 class="related-header-title">
@_localizer["related-posts"]
</h3>
<a class="related-header-link ms-auto" href="~/">
@_localizer["view-all"]
<svg width="22" height="22" class="bi bi-arrow-left">
<use xlink:href="/_content/@ThemesStandardConstant.AssemblyName/img/icon-sprites.svg#bi-arrow-left"></use>
</svg>
</a>
</header>
<div class="row">
@foreach (var post in Model.PostSlug.Related)
{
<div class="col-12 col-md mb-4 mb-md-0">
<article class="post-grid d-flex flex-column">
<figure class="post-grid-cover" aria-hidden="true">
<img class="post-grid-img" src="~/@post.Cover" alt="@post.Title">
</figure>
@if (post.Categories != null)
{
<div class="post-grid-cats">
@foreach (var cat in post.Categories)
{
<a class="post-grid-cats-link" href="~/category/@cat.Content" tabindex="-1">@cat.Content</a>
}
</div>
}
<h2 class="post-grid-title">
<a class="post-grid-link" href="~/post/@post.Slug">@post.Title</a>
</h2>
<p class="post-grid-desc">
@Html.Raw(post.Description)
</p>
<div class="post-grid-meta d-flex">
<div class="post-grid-author">
<img class="post-grid-author-img" src="@UserHelper.CheckGetAvatarUrl(post.User.Avatar)" width="16" height="16" alt="@post.User.NickName" aria-hidden="true">
<span class="post-grid-author-name">@post.User.NickName</span>
</div>
<div class="post-grid-date">
<svg width="13" height="13" class="bi bi-calendar-event post-grid-date-icon">
<use xlink:href="/_content/@ThemesStandardConstant.AssemblyName/img/icon-sprites.svg#bi-calendar-event"></use>
</svg>
<time class="post-grid-date-time">@DateTimeHelper.ToFriendlyShortDateString(post.PublishedAt)</time>
</div>
<a class="post-grid-more ms-auto" href="~/post/@post.Slug" tabindex="-1">
<span>
@_localizer["read"]
</span>
<svg width="16" height="16" class="bi bi-arrow-right-short">
<use xlink:href="/_content/@ThemesStandardConstant.AssemblyName/img/icon-sprites.svg#bi-arrow-right-short"></use>
</svg>
</a>
</div>
</article>
</div>
}
</div>
</section>
}