-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathblogPost.tpl
More file actions
115 lines (90 loc) · 4.15 KB
/
blogPost.tpl
File metadata and controls
115 lines (90 loc) · 4.15 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{extends designs/site.tpl}
{block "meta-info"}
{$Post = $data}
<meta name="description" content="{$Post->Summary|default:$Post->Title|escape}" />
<meta property="og:site_name" content="{Laddr::$siteName|escape}" />
<meta property="og:url" content="http://{Site::getConfig(primary_hostname)}{$Post->getURL()}" />
<meta property="og:type" content="article">
<meta property="og:title" content="{$Post->Title|escape}" />
{if $Post->Summary}
<meta property="og:description" content="{$Post->Summary|escape}" />
<meta property="twitter:description" content="{$Post->Summary|escape}" />
{/if}
<meta property="article:published_time" content="{date($.const.DATE_W3C, $Post->Published)}" />
<meta property="article:author" content="http://{Site::getConfig(primary_hostname)}{$Post->Author->getURL()}" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="{$Post->Title|escape}" />
{if $Post->Summary}
{/if}
{if \RemoteSystems\Twitter::$siteHandle}
<meta name="twitter:site" content="@{\RemoteSystems\Twitter::$siteHandle}" />
<meta name="twitter:creator" content="@{\RemoteSystems\Twitter::$siteHandle}" />
{/if}
<?php
// find best media in post
$imageUrl = null;
foreach ($this->scope['Post']->Items AS $Item) {
if ($Item->isA(\Emergence\CMS\Item\Media::class) && $Item->Media) {
$imageUrl = $Item->Media->getThumbnailRequest(\Emergence\CMS\Item\Media::$fullWidth, \Emergence\CMS\Item\Media::$fullHeight);
}
}
// default to site logo
if (!$imageUrl && Site::resolvePath('site-root/img/cover.jpg')) {
$imageUrl = Site::getVersionedRootUrl('img/cover.jpg');
}
$this->scope['imageUrl'] = $imageUrl;
?>
{if $imageUrl}
<link rel="image_src" href="{$imageUrl|escape}" />
<meta property="og:image" content="{$imageUrl|escape}" />
<meta name="twitter:image" content="{$imageUrl|escape}" />
{/if}
{/block}
{block "css"}
{$dwoo.parent}
{cssmin "pages/article.css"}
{/block}
{block "title"}{$data->Title} — {$dwoo.parent}{/block}
{block "content-wrapper"}
<div class="container-fluid">
{block "content"}
{$Post = $data}
<article class="article">
<header class="article-header">
{if Emergence\CMS\BlogRequestHandler::checkWriteAccess($Post)}
<div class="btn-toolbar pull-right">
<div class="btn-group">
<a href="{$Post->getURL()}/edit" class="btn btn-default">{*glyph "pencil"*} {_ Edit}</a>
<a href="{$Post->getURL()}/delete"
class="btn btn-danger confirm"
data-confirm-yes="Delete Post"
data-confirm-no="Don’t Delete"
data-confirm-title="Deleting Post"
data-confirm-body="Are you sure you want to delete the post “{$Post->Title|escape}?”"
data-confirm-destructive="true"
data-confirm-success-target=".blog-post"
data-confirm-success-message="Blog post deleted">{*glyph "trash"*} {_ Delete}</a>
</div>
</div>
{/if}
<h1 class="header-title"><a href="{$Post->getURL()}">{$Post->Title|escape}</a></h1>
<div class="article-meta">
by {personLink $Post->Author photo=yes photoSize=36 pixelRatio=2 summary=no}
on <a href="{$Post->getURL()}">{timestamp $Post->Published}</a>
</div>
{if $Post->Summary}
<div class="article-summary">
{$Post->Summary|escape}
</div>
{/if}
</header>
<div class="article-body">
{$Post->RenderBody()}
</div>
<section class="article-comments">
{commentSection $Post}
</section>
</article>
{/block}
</div>
{/block}