Skip to content

Commit b6f588f

Browse files
author
Truong Nguyen V
committed
fix layout
1 parent 6f192e9 commit b6f588f

File tree

5 files changed

+77
-4
lines changed

5 files changed

+77
-4
lines changed

_layouts/default.html

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<title>{% if page.title %}{{ page.title }} – {% endif %}{{ site.name }} – {{ site.description }}</title>
5-
5+
<link rel="icon" type="image/png" href="../favicon.ico"/>
66
{% include meta.html %}
77

88
<!--[if lt IE 9]>
@@ -11,7 +11,7 @@
1111

1212
<link rel="stylesheet" type="text/css" href="{{ site.baseurl }}/style.css" />
1313
<link rel="alternate" type="application/rss+xml" title="{{ site.name }} - {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />
14-
<link rel="icon" type="image/png" href="../favicon.ico"/>
14+
1515
<!-- Created with Jekyll Now - http://github.com/barryclark/jekyll-now -->
1616
</head>
1717

@@ -28,6 +28,7 @@ <h1 class="site-name"><a href="{{ site.baseurl }}/">{{ site.name }}</a></h1>
2828

2929
<nav>
3030
<a href="{{ site.baseurl }}/">Blog</a>
31+
<a href="{{ site.baseurl }}/tags">Tags</a>
3132
<a href="{{ site.baseurl }}/about">About</a>
3233
</nav>
3334
</header>

_layouts/post.html

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,23 @@
55
<article class="post">
66
<h1>{{ page.title }}</h1>
77

8+
<div class="date3">
9+
Viết bởi {{page.author}} - Vào ngày {{ page.date | date: "%d/%m/%Y" }}
10+
</div>
11+
812
<div class="entry">
913
{{ content }}
1014
</div>
1115

12-
<div class="date">
16+
<!-- <div class="date">
17+
1318
Viết bởi {{page.author}} - Vào ngày {{ page.date | date: "%d/%m/%Y" }}
19+
</div> -->
20+
<div>
21+
<small>Tags:</small>
22+
{% for tag in page.tags %}
23+
<a href="#{{ tag | slugify }}"> {{ tag }} </a>,
24+
{% endfor %}
1425
</div>
1526

1627
{% include disqus.html %}

_posts/2020-09-03-Hello-World.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
layout: post
33
title: My first post!
4-
categories: category1 category2
54
author: <a target="_blank" rel="noopener noreferrer" href="https://google.com">Truong Nguyen V.</a>
5+
tags: [tag1, tag2]
66
---
77

88
My first post content here

style.scss

+7
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,13 @@ img {
127127
// text-align: right;
128128
}
129129

130+
.date3 {
131+
font-style: italic;
132+
color: $gray;
133+
font-size: smaller;
134+
text-align: right;
135+
}
136+
130137
// Specify the color of the selection
131138
::-moz-selection {
132139
color: $black;

tags.html

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
layout: default
3+
title: Tag
4+
---
5+
6+
{% comment %}
7+
=======================
8+
The following part extracts all the tags from your posts and sort tags, so that you do not need to manually collect your tags to a place.
9+
=======================
10+
{% endcomment %}
11+
{% assign rawtags = "" %}
12+
{% for post in site.posts %}
13+
{% assign ttags = post.tags | join:'|' | append:'|' %}
14+
{% assign rawtags = rawtags | append:ttags %}
15+
{% endfor %}
16+
{% assign rawtags = rawtags | split:'|' | sort %}
17+
18+
{% comment %}
19+
=======================
20+
The following part removes dulpicated tags and invalid tags like blank tag.
21+
=======================
22+
{% endcomment %}
23+
{% assign tags = "" %}
24+
{% for tag in rawtags %}
25+
{% if tag != "" %}
26+
{% if tags == "" %}
27+
{% assign tags = tag | split:'|' %}
28+
{% endif %}
29+
{% unless tags contains tag %}
30+
{% assign tags = tags | join:'|' | append:'|' | append:tag | split:'|' %}
31+
{% endunless %}
32+
{% endif %}
33+
{% endfor %}
34+
35+
{% comment %}
36+
=======================
37+
The purpose of this snippet is to list all your posts posted with a certain tag.
38+
======================
39+
{% endcomment %}
40+
{% for tag in tags %}
41+
<h2 id="{{ tag | slugify }}">{{ tag }}</h2>
42+
<ul>
43+
{% for post in site.posts %}
44+
{% if post.tags contains tag %}
45+
<li>
46+
<a href="{{ post.url }}">{{ post.title }}</a> - <small class="date3">{{ post.date | date: "%d/%m/%Y" }}</small>
47+
<!-- {% for tag in post.tags %}
48+
<a class="tag" href="/blog/tag/#{{ tag | slugify }}">{{ tag }}</a>
49+
{% endfor %} -->
50+
</li>
51+
{% endif %}
52+
{% endfor %}
53+
</ul>
54+
{% endfor %}

0 commit comments

Comments
 (0)