Skip to content

Commit e3d6dbd

Browse files
authored
Merge pull request #6 from Slavetomints/layouts-edit
edit post layout to include image in preview but not in article
2 parents 9d77808 + 12e1986 commit e3d6dbd

File tree

1 file changed

+179
-0
lines changed

1 file changed

+179
-0
lines changed

_layouts/post.html

Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
layout: default
3+
refactor: true
4+
panel_includes:
5+
- toc
6+
tail_includes:
7+
- related-posts
8+
- post-nav
9+
script_includes:
10+
- comment
11+
---
12+
13+
{% include lang.html %}
14+
15+
{% include toc-status.html %}
16+
17+
<article class="px-1" data-toc="{{ enable_toc }}">
18+
<header>
19+
<h1 data-toc-skip>{{ page.title }}</h1>
20+
{% if page.description %}
21+
<p class="post-desc fw-light mb-4">{{ page.description }}</p>
22+
{% endif %}
23+
24+
<div class="post-meta text-muted">
25+
<!-- published date -->
26+
<span>
27+
{{ site.data.locales[lang].post.posted }}
28+
{% include datetime.html date=page.date tooltip=true lang=lang %}
29+
</span>
30+
31+
<!-- lastmod date -->
32+
{% if page.last_modified_at and page.last_modified_at != page.date %}
33+
<span>
34+
{{ site.data.locales[lang].post.updated }}
35+
{% include datetime.html date=page.last_modified_at tooltip=true lang=lang %}
36+
</span>
37+
{% endif %}
38+
39+
{% if page.image and page.show_image != false %}
40+
{% capture src %}src="{{ page.image.path | default: page.image }}"{% endcapture %}
41+
{% capture class %}class="preview-img{% if page.image.no_bg %}{{ ' no-bg' }}{% endif %}"{% endcapture %}
42+
{% capture alt %}alt="{{ page.image.alt | xml_escape | default: "Preview Image" }}"{% endcapture %}
43+
44+
{% if page.image.lqip %}
45+
{%- capture lqip -%}lqip="{{ page.image.lqip }}"{%- endcapture -%}
46+
{% endif %}
47+
48+
<div class="mt-3 mb-3">
49+
<img {{ src }} {{ class }} {{ alt }} w="1200" h="630" {{ lqip }}>
50+
{%- if page.image.alt -%}
51+
<figcaption class="text-center pt-2 pb-2">{{ page.image.alt }}</figcaption>
52+
{%- endif -%}
53+
</div>
54+
{% endif %}
55+
56+
<div class="d-flex justify-content-between">
57+
<!-- author(s) -->
58+
<span>
59+
{% if page.author %}
60+
{% assign authors = page.author %}
61+
{% elsif page.authors %}
62+
{% assign authors = page.authors %}
63+
{% endif %}
64+
65+
{{ site.data.locales[lang].post.written_by }}
66+
67+
<em>
68+
{% if authors %}
69+
{% for author in authors %}
70+
{% if site.data.authors[author].url -%}
71+
<a href="{{ site.data.authors[author].url }}">{{ site.data.authors[author].name }}</a>
72+
{%- else -%}
73+
{{ site.data.authors[author].name }}
74+
{%- endif %}
75+
{% unless forloop.last %}{{ '</em>, <em>' }}{% endunless %}
76+
{% endfor %}
77+
{% else %}
78+
<a href="{{ site.social.links[0] }}">{{ site.social.name }}</a>
79+
{% endif %}
80+
</em>
81+
</span>
82+
83+
<div>
84+
<!-- pageviews -->
85+
{% if site.pageviews.provider and site.analytics[site.pageviews.provider].id %}
86+
<span>
87+
<em id="pageviews">
88+
<i class="fas fa-spinner fa-spin small"></i>
89+
</em>
90+
{{ site.data.locales[lang].post.pageview_measure }}
91+
</span>
92+
{% endif %}
93+
94+
<!-- read time -->
95+
{% include read-time.html content=content prompt=true lang=lang %}
96+
</div>
97+
</div>
98+
</div>
99+
</header>
100+
101+
{% if enable_toc %}
102+
<div id="toc-bar" class="d-flex align-items-center justify-content-between invisible">
103+
<span class="label text-truncate">{{ page.title }}</span>
104+
<button type="button" class="toc-trigger btn me-1">
105+
<i class="fa-solid fa-list-ul fa-fw"></i>
106+
</button>
107+
</div>
108+
109+
<button id="toc-solo-trigger" type="button" class="toc-trigger btn btn-outline-secondary btn-sm">
110+
<span class="label ps-2 pe-1">{{- site.data.locales[lang].panel.toc -}}</span>
111+
<i class="fa-solid fa-angle-right fa-fw"></i>
112+
</button>
113+
114+
<dialog id="toc-popup" class="p-0">
115+
<div class="header d-flex flex-row align-items-center justify-content-between">
116+
<div class="label text-truncate py-2 ms-4">{{- page.title -}}</div>
117+
<button id="toc-popup-close" type="button" class="btn mx-1 my-1 opacity-75">
118+
<i class="fas fa-close"></i>
119+
</button>
120+
</div>
121+
<div id="toc-popup-content" class="px-4 py-3 pb-4"></div>
122+
</dialog>
123+
{% endif %}
124+
125+
<div class="content">
126+
{{ content }}
127+
</div>
128+
129+
<div class="post-tail-wrapper text-muted">
130+
<!-- categories -->
131+
{% if page.categories.size > 0 %}
132+
<div class="post-meta mb-3">
133+
<i class="far fa-folder-open fa-fw me-1"></i>
134+
{% for category in page.categories %}
135+
<a href="{{ site.baseurl }}/categories/{{ category | slugify | url_encode }}/">{{ category }}</a>
136+
{%- unless forloop.last -%},{%- endunless -%}
137+
{% endfor %}
138+
</div>
139+
{% endif %}
140+
141+
<!-- tags -->
142+
{% if page.tags.size > 0 %}
143+
<div class="post-tags">
144+
<i class="fa fa-tags fa-fw me-1"></i>
145+
{% for tag in page.tags %}
146+
<a
147+
href="{{ site.baseurl }}/tags/{{ tag | slugify | url_encode }}/"
148+
class="post-tag no-text-decoration"
149+
>
150+
{{- tag -}}
151+
</a>
152+
{% endfor %}
153+
</div>
154+
{% endif %}
155+
156+
<div
157+
class="
158+
post-tail-bottom
159+
d-flex justify-content-between align-items-center mt-5 pb-2
160+
"
161+
>
162+
<div class="license-wrapper">
163+
{% if site.data.locales[lang].copyright.license.template %}
164+
{% capture _replacement %}
165+
<a href="{{ site.data.locales[lang].copyright.license.link }}">
166+
{{ site.data.locales[lang].copyright.license.name }}
167+
</a>
168+
{% endcapture %}
169+
170+
{{ site.data.locales[lang].copyright.license.template | replace: ':LICENSE_NAME', _replacement }}
171+
{% endif %}
172+
</div>
173+
174+
{% include post-sharing.html lang=lang %}
175+
</div>
176+
<!-- .post-tail-bottom -->
177+
</div>
178+
<!-- div.post-tail-wrapper -->
179+
</article>

0 commit comments

Comments
 (0)