generated from brendanhasz/github-io-blog-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
93 lines (83 loc) · 2.73 KB
/
index.html
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
---
layout: default
---
<div>
<p>{{ site.long_description }}</p>
{% comment %}
Get tags from all posts
{% endcomment %}
{% assign rawtags = "" %}
{% for post in site.posts %}
{% assign ttags = post.tags | join:'|' | append:'|' %}
{% assign rawtags = rawtags | append:ttags %}
{% endfor %}
{% assign rawtags = rawtags | split:'|' | sort %}
{% comment %}
Remove duplicate tags
{% endcomment %}
{% assign tags = "" %}
{% for tag in rawtags %}
{% if tag != "" %}
{% if tags == "" %}
{% assign tags = tag | split:'|' %}
{% endif %}
{% unless tags contains tag %}
{% assign tags = tags | join:'|' | append:'|' | append:tag | split:'|' %}
{% endunless %}
{% endif %}
{% endfor %}
{% comment %}
Get site url without trailing forward slash
{% endcomment %}
{% if site.main_github_io %}
{% assign site_url = "" %}
{% else %}
{% assign site_url_len = site.url | size | minus: 1 %}
{% assign site_url = site.url | slice: 0, site_url_len %}
{% endif %}
<p>
<h2> Tags </h2>
<a onclick="show_tag_section('all_posts')" style="cursor: pointer;" class="post_tag"> All Posts </a>
{% for tag in tags %}
<a onclick="show_tag_section('{{ tag | slugify }}')" style="cursor: pointer;" class="post_tag"> {{ tag }} </a>
{% endfor %}
</p>
<div id="all_posts">
<h2> All Posts </h2>
{% for post in site.posts %}
<div class="post_block">
<h3><a href="{{ site_url }}{{ post.url }}">{{ post.title }}</a></h3>
<span><strong>{{ post.date | date_to_string }}</strong> - {{ post.tags | array_to_sentence_string }}</span>
{% if post.description %}
<p> {{ post.description }} </p>
{% endif %}
{% if post.img_url %}
<a href="{{ site_url }}{{ post.url }}" title="{{ post.title }}">
<img src="{{ post.img_url }}" class="center_img">
</a>
{% endif %}
</div>
{% endfor %}
</div>
{% for tag in tags %}
<div id="{{ tag | slugify }}" class="by_tag">
<h2 id="{{ tag | slugify }}">Posts tagged "{{ tag }}"</h2>
{% for post in site.posts %}
{% if post.tags contains tag %}
<div class="post_block">
<h3><a href="{{ site_url }}{{ post.url }}">{{ post.title }}</a></h3>
<span><strong>{{ post.date | date_to_string }}</strong> - {{ post.tags | array_to_sentence_string }}</span>
{% if post.description %}
<p> {{ post.description }} </p>
{% endif %}
{% if post.img_url %}
<a href="{{ site_url }}{{ post.url }}" title="{{ post.title }}">
<img src="{{ post.img_url }}" class="center_img">
</a>
{% endif %}
</div>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>