-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblog.html
More file actions
46 lines (40 loc) · 1.22 KB
/
Copy pathblog.html
File metadata and controls
46 lines (40 loc) · 1.22 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
---
layout: default
title: 記事一覧
---
<h2>
記事一覧
</h2>
<ul>
<script type="text/javascript">
var posts = new Array();
{% for post in site.posts %}
// jekyllから情報をもらい配列に格納
// title, excerpt, url, date
posts.push(new Array("{{ post.title }}", "{{ post.excerpt | replace:'\n',''}}", "{{ post.url }}", new Date({{ post.date | date: "%Y, 1%m - 101, %d"}})));
{% endfor %}
function compare(a, b){
return b[3].getTime() - a[3].getTime();
}
posts.sort(compare);
posts.forEach(
function writePost(post){
yyyy = post[3].getYear();
mm = post[3].getMonth() + 1;
dd = post[3].getDate();
if (yyyy < 2000) { yyyy += 1900; }
if (mm < 10) { mm = "0" + mm; }
if (dd < 10) { dd = "0" + dd; }
dateS = "[" + yyyy + "/" + mm + "/" + dd + "]";
document.write("<li>");
document.write(" <a href='" + post[2] + "'>");
document.write(" " + dateS + post[0]);
document.write(" </a>");
document.write(" <p>");
document.write(" " + post[1]);
document.write(" </p>");
document.write("</li>");
}
);
</script>
</ul>