Skip to content

Commit ccbe57b

Browse files
formatted working solution
1 parent 8d2dbd4 commit ccbe57b

File tree

5 files changed

+72
-9
lines changed

5 files changed

+72
-9
lines changed

_includes/tags.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{% for tag in page.tags %}
2-
{% capture tag_name %}{{ tag }}{% endcapture %}
3-
<a href="/tag/#{{ tag_name }}" class="badge badge-pil"><code ><nobr>{{ tag_name }}</nobr></code></a>
2+
{% if tag != 'home' %}
3+
{% capture tag_name %}{{ tag }}{% endcapture %}
4+
<a href="/tag/#{{ tag_name }}" class="badge badge-pil"><code ><nobr>{{ tag_name }}</nobr></code></a>
5+
{% endif %}
46
{% endfor %}

_layouts/post.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ <h2 class="subheading">{{ page.subtitle }}</h2>
5858
<div class="col-lg-8 col-md-10 mx-auto">
5959

6060
{{ content }}
61-
62-
<hr>
63-
61+
6462
{% include tags.html %}
6563

64+
<hr>
65+
6666
{% include social-share.html %}
6767

6868
{% if page.comments != false %}

assets/custom/scss/_tags.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// for tags
2+
3+
.badge {
4+
color: dimgrey;
5+
padding: 10px;
6+
font-family: "Courier New", Courier, monospace;
7+
background-color: #e7e7e7;
8+
}
9+

assets/custom/scss/custom.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
@import "social-share.scss";
33
@import "markdown.scss";
44
@import "pygments.scss";
5+
@import "tags.scss";

tag/index.html

Lines changed: 55 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
layout: page
3-
title: tag
3+
title: Tags
44
background: '/img/bg-post.jpg'
55
---
66
{% capture tags %}
@@ -11,10 +11,61 @@
1111
{% assign sortedtags = tags | split:' ' | sort %}
1212

1313
{% for tag in sortedtags %}
14-
<h3 id="{{ tag }}">{{ tag }}</h3>
14+
{% if tag != 'home' %}
15+
<a href="/tag/#{{ tag }}" class="badge badge-pil"><code ><nobr>{{ tag }}</nobr></code></a>
16+
{% endif %}
17+
{% endfor %}
18+
<br> <br>
19+
20+
{% for tag in sortedtags %}
21+
{% if tag != 'home' %}
22+
<h3><a href="/tag/#{{ tag }}" class="badge badge-pil" id="{{ tag }}"><code ><nobr>{{ tag }}</nobr></code></a></h3>
1523
<ul>
1624
{% for post in site.tags[tag] %}
17-
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
25+
26+
<article class="post-preview">
27+
<a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}">
28+
<h2 class="post-title">{{ post.title }}</h2>
29+
{% if post.subtitle %}
30+
<h3 class="post-subtitle">{{ post.subtitle }}</h3>
31+
{% else %}
32+
<h3 class="post-subtitle">{{ post.excerpt | strip_html | truncatewords: 15 }}</h3>
33+
{% endif %}
34+
</a>
35+
36+
{% if post.author %}
37+
{% assign authors = post.author %}
38+
{% else %}
39+
{% assign authors = site.author %}
40+
{% endif %}
41+
42+
<p class="meta">Posted by
43+
{% if authors.first %}
44+
{% for author in authors %}
45+
{% if post.author_url[forloop.index0] %}
46+
<a target="_blank" href="{{ post.author_url[forloop.index0] }}">{{ author }}</a>{% unless forloop.last %},{% endunless %}
47+
{% else %}
48+
{{ author }}{% unless forloop.last %},{% endunless %}
49+
{% endif %}
50+
{% endfor %}
51+
{% else %}
52+
{% if post.author_url %}
53+
<a target="_blank" href="{{ post.author_url }}">{{ authors }}</a>
54+
{% else %}
55+
{{ authors }}
56+
{% endif %}
57+
{% endif %}
58+
on {{ post.date | date: '%B %d, %Y' }} &middot; {% include read_time.html content=post.content %} &middot;
59+
<a href="{{ post.url | prepend: site.baseurl | replace: '//', '/' }}#disqus_thread"></a>
60+
</p>
61+
62+
</article>
63+
<hr>
64+
65+
1866
{% endfor %}
1967
</ul>
20-
{% endfor %}
68+
69+
{% endif %}
70+
{% endfor %}
71+

0 commit comments

Comments
 (0)