summaryrefslogtreecommitdiff
path: root/_includes/functions
diff options
context:
space:
mode:
authorJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-11 12:19:34 +0800
committerJeffrey Tse <jeffreytse.mail@gmail.com>2019-09-11 12:21:17 +0800
commit61eae5c5f9881cab29712f6e696085baa977e1f9 (patch)
treebb301b58b94fee5dcefbdfae8f0c8fc13ee5bd21 /_includes/functions
parentcd3a8163dd997d0a7c4d320816651efa8f7dce60 (diff)
release: v1.0.0
Diffstat (limited to '_includes/functions')
-rw-r--r--_includes/functions/get_categories.html12
-rw-r--r--_includes/functions/get_datetimes.html18
-rw-r--r--_includes/functions/get_tags.html12
-rw-r--r--_includes/functions/get_value.html17
-rw-r--r--_includes/functions/log.html17
5 files changed, 76 insertions, 0 deletions
diff --git a/_includes/functions/get_categories.html b/_includes/functions/get_categories.html
new file mode 100644
index 0000000..babb7a0
--- /dev/null
+++ b/_includes/functions/get_categories.html
@@ -0,0 +1,12 @@
+{% assign split_mark = '<|>' %}
+
+{% assign categories = '' %}
+{% for category in site.categories %}
+ {% assign name = category | first %}
+ {% assign categories = categories | append: split_mark | append: name %}
+{% endfor %}
+
+{% assign return = categories
+ | remove_first: split_mark
+ | split: split_mark
+ | sort: self %}
diff --git a/_includes/functions/get_datetimes.html b/_includes/functions/get_datetimes.html
new file mode 100644
index 0000000..4398fbf
--- /dev/null
+++ b/_includes/functions/get_datetimes.html
@@ -0,0 +1,18 @@
+{% if include.filter %}
+ {% assign filter = include.filter %}
+{% endif %}
+
+{% assign split_mark = '<|>' %}
+
+{% assign dates = '' %}
+{% for post in site.posts %}
+ {% assign name = post.date | date: filter %}
+ {% assign dates = dates | append: split_mark | append: name %}
+{% endfor %}
+
+{% assign return = dates
+ | remove_first: split_mark
+ | split: split_mark
+ | sort: self
+ | uniq %}
+
diff --git a/_includes/functions/get_tags.html b/_includes/functions/get_tags.html
new file mode 100644
index 0000000..8528eeb
--- /dev/null
+++ b/_includes/functions/get_tags.html
@@ -0,0 +1,12 @@
+{% assign split_mark = '<|>' %}
+
+{% assign tags = '' %}
+{% for tag in site.tags %}
+ {% assign name = tag | first %}
+ {% assign tags = tags | append: split_mark | append: name %}
+{% endfor %}
+
+{% assign return = tags
+ | remove_first: split_mark
+ | split: split_mark
+ | sort: self %}
diff --git a/_includes/functions/get_value.html b/_includes/functions/get_value.html
new file mode 100644
index 0000000..2d90b19
--- /dev/null
+++ b/_includes/functions/get_value.html
@@ -0,0 +1,17 @@
+{%- if include.name -%}
+ {%- assign name = include.name -%}
+{%- endif -%}
+
+{%- assign return = include.return -%}
+
+{%- if page[name] -%}
+ {%- assign return = page[name] -%}
+{%- elsif site.data[name] -%}
+ {%- assign return = site.data[name] -%}
+{%- elsif site.defaults[page.layout][name] -%}
+ {%- assign return = site.defaults[page.layout][name] -%}
+{%- elsif site.data.defaults[page.layout][name] -%}
+ {%- assign return = site.data.defaults[page.layout][name] -%}
+{%- elsif layout[name] -%}
+ {%- assign return = layout[name] -%}
+{%- endif -%}
diff --git a/_includes/functions/log.html b/_includes/functions/log.html
new file mode 100644
index 0000000..b2a6130
--- /dev/null
+++ b/_includes/functions/log.html
@@ -0,0 +1,17 @@
+{% if include.level %}
+ {% assign level = include.level %}
+{% endif %}
+
+{% if include.msg %}
+ {% assign msg = include.msg %}
+{% endif %}
+
+{% if site.debug == true %}
+ {% if level == 'debug' %}
+ {% if jekyll.environment == "development" %}
+ <!-- {{ msg }} -->
+ {% endif %}
+ {% else %}
+ <!-- {{ msg }} -->
+ {% endif %}
+{% endif %}