jekyll-theme-yat 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +21 -0
  3. data/README.md +52 -0
  4. data/_data/defaults.yml +4 -0
  5. data/_data/translate_langs.yml +30 -0
  6. data/_includes/extensions/comments/disqus.html +18 -0
  7. data/_includes/extensions/comments/gitment.html +15 -0
  8. data/_includes/extensions/geopattern.html +21 -0
  9. data/_includes/extensions/google-analytics.html +12 -0
  10. data/_includes/extensions/google-translate.html +98 -0
  11. data/_includes/extensions/hashlocate.html +39 -0
  12. data/_includes/extensions/mathjax.html +10 -0
  13. data/_includes/extensions/trianglify.html +23 -0
  14. data/_includes/functions/get_categories.html +12 -0
  15. data/_includes/functions/get_datetimes.html +18 -0
  16. data/_includes/functions/get_tags.html +12 -0
  17. data/_includes/functions/get_value.html +19 -0
  18. data/_includes/functions/log.html +17 -0
  19. data/_includes/functions.html +25 -0
  20. data/_includes/head.html +16 -0
  21. data/_includes/sidebar/archive-list.html +10 -0
  22. data/_includes/sidebar/article-menu.html +59 -0
  23. data/_includes/sidebar/category-list.html +9 -0
  24. data/_includes/sidebar/common-list.html +25 -0
  25. data/_includes/sidebar/google-translate.html +3 -0
  26. data/_includes/sidebar/tag-list.html +9 -0
  27. data/_includes/views/article.html +11 -0
  28. data/_includes/views/banner.html +66 -0
  29. data/_includes/views/footer.html +13 -0
  30. data/_includes/views/header.html +44 -0
  31. data/_includes/views/pagination.html +33 -0
  32. data/_includes/views/paginator.html +21 -0
  33. data/_includes/views/post-header.html +11 -0
  34. data/_includes/views/post-item.html +13 -0
  35. data/_includes/views/segments.html +21 -0
  36. data/_includes/views/site-brand.html +7 -0
  37. data/_layouts/404.html +25 -0
  38. data/_layouts/archives.html +18 -0
  39. data/_layouts/articles.html +14 -0
  40. data/_layouts/categories.html +16 -0
  41. data/_layouts/default.html +23 -0
  42. data/_layouts/framework.html +35 -0
  43. data/_layouts/home.html +8 -0
  44. data/_layouts/post.html +53 -0
  45. data/_layouts/tags.html +16 -0
  46. data/_sass/misc/article-menu.scss +47 -0
  47. data/_sass/misc/common-list.scss +49 -0
  48. data/_sass/misc/google-translate.scss +190 -0
  49. data/_sass/yat/_base.scss +258 -0
  50. data/_sass/yat/_layout.scss +388 -0
  51. data/_sass/yat/_syntax-highlighting.scss +105 -0
  52. data/_sass/yat.scss +69 -0
  53. data/assets/main.scss +25 -0
  54. metadata +179 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 8edc986ecb82dc1de62b66687d6ce4344d9c7a7dc5c1c9f91ce7f9edc3cc0623
4
+ data.tar.gz: '08865057323c3d868632efaf007b096531fe614c22a4a331da7ebfe9b63c9473'
5
+ SHA512:
6
+ metadata.gz: b3863db5860dbf115dfb69824347343d5f5b05df981198cb1613df2ddbed1fcbe4f1bd7b72992e747cf122c3c4a89cba1f007dd9db905773d01aba4e934dc1da
7
+ data.tar.gz: 2767e246bf177a36fef0081d99920c8ecb69419aec34355e6ed806ff01b77ef4c33dfc4828eeb9c7c7f308e8a0c0526fa1e36c5c2d095fc81aa7928948db2278
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Jeffrey Tse
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # jekyll-theme-yat
2
+
3
+ Welcome to your new Jekyll theme! In this directory, you'll find the files you need to be able to package up your theme into a gem. Put your layouts in `_layouts`, your includes in `_includes`, your sass files in `_sass` and any other assets in `assets`.
4
+
5
+ To experiment with this code, add some sample content and run `bundle exec jekyll serve` – this directory is setup just like a Jekyll site!
6
+
7
+ TODO: Delete this and the text above, and describe your gem
8
+
9
+
10
+ ## Installation
11
+
12
+ Add this line to your Jekyll site's `Gemfile`:
13
+
14
+ ```ruby
15
+ gem "jekyll-theme-yat"
16
+ ```
17
+
18
+ And add this line to your Jekyll site's `_config.yml`:
19
+
20
+ ```yaml
21
+ theme: jekyll-theme-yat
22
+ ```
23
+
24
+ And then execute:
25
+
26
+ $ bundle
27
+
28
+ Or install it yourself as:
29
+
30
+ $ gem install jekyll-theme-yat
31
+
32
+ ## Usage
33
+
34
+ TODO: Write usage instructions here. Describe your available layouts, includes, sass and/or assets.
35
+
36
+ ## Contributing
37
+
38
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jeffreytse/jekyll-theme-yat. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
39
+
40
+ ## Development
41
+
42
+ To set up your environment to develop this theme, run `bundle install`.
43
+
44
+ Your theme is setup just like a normal Jekyll site! To test your theme, run `bundle exec jekyll serve` and open your browser at `http://localhost:4000`. This starts a Jekyll server using your theme. Add pages, documents, data, etc. like normal to test your theme's contents. As you make modifications to your theme and to your content, your site will regenerate and you should see the changes in the browser after a refresh, just like normal.
45
+
46
+ When your theme is released, only the files in `_data`, `_layouts`, `_includes`, `_sass` and `assets` tracked with Git will be bundled.
47
+ To add a custom directory to your theme-gem, please edit the regexp in `jekyll-theme-yat.gemspec` accordingly.
48
+
49
+ ## License
50
+
51
+ The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
52
+
@@ -0,0 +1,4 @@
1
+ home:
2
+ heading: "Your awesome heading"
3
+ subheading: "Your awesome subheading"
4
+ banner: "Your image url"
@@ -0,0 +1,30 @@
1
+ # Translate languges
2
+ # langs refer to https://cloud.google.com/translate/docs/languages
3
+
4
+ - lang: en
5
+ img: https://www.countryflags.io/us/flat/64.png
6
+ text: English
7
+
8
+ - lang: fr
9
+ img: https://www.countryflags.io/fr/flat/64.png
10
+ text: Franch
11
+
12
+ - lang: zh-CN
13
+ img: https://www.countryflags.io/cn/flat/64.png
14
+ text: Chinese(Simple)
15
+
16
+ - lang: zh-TW
17
+ img: https://www.countryflags.io/tw/flat/64.png
18
+ text: Chinese(Traditional)
19
+
20
+ - lang: ja
21
+ img: https://www.countryflags.io/jp/flat/64.png
22
+ text: Japan
23
+
24
+ - lang: ko
25
+ img: https://www.countryflags.io/kr/flat/64.png
26
+ text: Korean
27
+
28
+ - lang: ru
29
+ img: https://www.countryflags.io/ru/flat/64.png
30
+ text: Russia
@@ -0,0 +1,18 @@
1
+ <div id="disqus_thread"></div>
2
+ <script>
3
+ var disqus_config = function () {
4
+ this.page.url = '{{ page.url | absolute_url }}';
5
+ this.page.identifier = '{{ page.url | absolute_url }}';
6
+ };
7
+
8
+ (function() {
9
+ var d = document, s = d.createElement('script');
10
+
11
+ // s.src = 'https://{{ site.disqus.shortname }}.disqus.com/embed.js';
12
+ s.src = 'https://jeffreytse.disqus.com/embed.js';
13
+
14
+ s.setAttribute('data-timestamp', +new Date());
15
+ (d.head || d.body).appendChild(s);
16
+ })();
17
+ </script>
18
+ <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>
@@ -0,0 +1,15 @@
1
+ <div id="gitment_thread"></div>
2
+ <link rel="stylesheet" href="https://imsun.github.io/gitment/style/default.css">
3
+ <script src="https://imsun.github.io/gitment/dist/gitment.browser.js"></script>
4
+ <script>
5
+ var gitment = new Gitment({
6
+ id: '{{ page.id }}',
7
+ owner: '{{ site.gitment.username }}',
8
+ repo: '{{ site.gitment.repo }}',
9
+ oauth: {
10
+ client_id: '{{ site.gitment.client_id }}',
11
+ client_secret: '{{ site.gitment.client_secret }}',
12
+ },
13
+ });
14
+ gitment.render('gitment_thread')
15
+ </script>
@@ -0,0 +1,21 @@
1
+ {% if include.selector %}
2
+ {% assign selector = include.selector %}
3
+ {% endif %}
4
+
5
+ {% if include.seed %}
6
+ {% assign seed = include.seed %}
7
+ {% endif %}
8
+
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/geopattern/1.2.3/js/geopattern.min.js"></script>
10
+ <script>
11
+ function setRandomBgImage(selector, seed) {
12
+ var pattern = GeoPattern.generate(seed);
13
+ var element = document.querySelector(selector)
14
+ if (element) {
15
+ element.style.backgroundImage = pattern.toDataUrl();
16
+ }
17
+ }
18
+
19
+ setRandomBgImage('{{ selector }}', '{{ seed }}');
20
+ </script>
21
+
@@ -0,0 +1,12 @@
1
+ <script>
2
+ if(!(window.doNotTrack === "1" || navigator.doNotTrack === "1" || navigator.doNotTrack === "yes" || navigator.msDoNotTrack === "1")) {
3
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
4
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
5
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
6
+ })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
7
+
8
+ ga('create', '{{ site.google_analytics }}', 'auto');
9
+ ga('send', 'pageview');
10
+ }
11
+ </script>
12
+
@@ -0,0 +1,98 @@
1
+ {% if include.translate_langs %}
2
+ {% assign translate_langs = include.translate_langs %}
3
+ {% endif %}
4
+
5
+ <div id="google_translate_element" style="display: none;">
6
+ </div>
7
+
8
+ <span class="ct-language">
9
+ <ul class="list-unstyled ct-language-dropdown">
10
+ {% for item in translate_langs %}
11
+ <li>
12
+ <a href="#" class="lang-select" data-lang="{{ item.lang }}">
13
+ {% if item.img %}
14
+ <img src="{{ item.img }}" title="{{ item.text }}">
15
+ {% else %}
16
+ {{ item.text }}
17
+ {% endif %}
18
+ </a>
19
+ </li>
20
+ {% endfor %}
21
+ </ul>
22
+ </span>
23
+
24
+ <script type="text/javascript">
25
+ function googleTranslateElementInit() {
26
+ new google.translate.TranslateElement({
27
+ pageLanguage: '',
28
+ autoDisplay: false,
29
+ layout: google.translate.TranslateElement.InlineLayout.VERTICAL
30
+ }, 'google_translate_element');
31
+
32
+ function restoreLang() {
33
+ var iframe = document.getElementsByClassName('goog-te-banner-frame')[0];
34
+ if (!iframe) return;
35
+
36
+ var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
37
+ var restore_el = innerDoc.getElementsByTagName("button");
38
+
39
+ for (var i = 0; i < restore_el.length; i++) {
40
+ if (restore_el[i].id.indexOf("restore") >= 0) {
41
+ restore_el[i].click();
42
+ var close_el = innerDoc.getElementsByClassName("goog-close-link");
43
+ close_el[0].click();
44
+ return;
45
+ }
46
+ }
47
+ }
48
+
49
+ function triggerHtmlEvent(element, eventName) {
50
+ var event;
51
+ if (document.createEvent) {
52
+ event = document.createEvent('HTMLEvents');
53
+ event.initEvent(eventName, true, true);
54
+ element.dispatchEvent(event);
55
+ } else {
56
+ event = document.createEventObject();
57
+ event.eventType = eventName;
58
+ element.fireEvent('on' + event.eventType, event);
59
+ }
60
+ }
61
+
62
+ var googleCombo = document.querySelector("select.goog-te-combo");
63
+ var langSelect = document.querySelector('.ct-language');
64
+ langSelect.addEventListener('click', function(event) {
65
+ if (!event.target) {
66
+ return;
67
+ }
68
+
69
+ var selected = document.querySelector('.ct-language .ct-language-selected');
70
+ if (selected) {
71
+ selected.classList.remove('ct-language-selected');
72
+ }
73
+
74
+ var target = event.target;
75
+ while (target && target !== langSelect ) {
76
+ if (target.matches('.lang-select')) {
77
+ break;
78
+ }
79
+ target = target.parentElement;
80
+ }
81
+
82
+ if (target && target.matches('.lang-select')) {
83
+ var lang = target.getAttribute('data-lang');
84
+ if (googleCombo.value == lang) {
85
+ restoreLang();
86
+ } else {
87
+ target.parentElement.classList.add('ct-language-selected');
88
+ googleCombo.value = lang;
89
+ triggerHtmlEvent(googleCombo, 'change');
90
+ }
91
+ }
92
+
93
+ event.preventDefault();
94
+ });
95
+ }
96
+ </script>
97
+
98
+ <script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
@@ -0,0 +1,39 @@
1
+ <script>
2
+ function hashLocate(hashValue) {
3
+ hashValue = hashValue.replace(/^.*#h-/, '');
4
+ var element = document.getElementById(hashValue);
5
+
6
+ if (!element) {
7
+ return;
8
+ }
9
+
10
+ var headerHeight = 0;
11
+ var header = document.querySelector('header');
12
+ if (header) {
13
+ headerHeight = header.offsetHeight;
14
+ }
15
+ var supportPageOffset = window.pageXOffset !== undefined;
16
+ var isCSS1Compat = ((document.compatMode || "") === "CSS1Compat");
17
+
18
+ var x = supportPageOffset ? window.pageXOffset : isCSS1Compat ? document.documentElement.scrollLeft : document.body.scrollLeft;
19
+ var y = supportPageOffset ? window.pageYOffset : isCSS1Compat ? document.documentElement.scrollTop : document.body.scrollTop;
20
+
21
+ var offsetY = element.offsetTop - headerHeight - 12;
22
+ if (y === offsetY) {
23
+ return;
24
+ }
25
+
26
+ window.scrollTo(x, offsetY);
27
+ }
28
+
29
+ // The first event occurred
30
+ if (window.location.hash) {
31
+ hashLocate(window.location.hash);
32
+ }
33
+
34
+ window.addEventListener('click', function(event) {
35
+ if (event.target.matches('a')) {
36
+ hashLocate(event.target.getAttribute('href'));
37
+ }
38
+ });
39
+ </script>
@@ -0,0 +1,10 @@
1
+ <script type="text/x-mathjax-config">
2
+ MathJax.Hub.Config({
3
+ tex2jax: {
4
+ skipTags: ['script', 'noscript', 'style', 'textarea', 'pre'],
5
+ inlineMath: [['$','$']]
6
+ }
7
+ });
8
+ </script>
9
+ <script
10
+ src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML" type="text/javascript"></script>
@@ -0,0 +1,23 @@
1
+ {% if include.selector %}
2
+ {% assign selector = include.selector %}
3
+ {% endif %}
4
+
5
+ {% if include.seed %}
6
+ {% assign seed = include.seed %}
7
+ {% endif %}
8
+
9
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/trianglify/2.0.0/trianglify.min.js"></script>
10
+ <script>
11
+ function setRandomBgImage(selector, seed) {
12
+ var element = document.querySelector(selector);
13
+ if (!element) return;
14
+ var pattern = Trianglify({
15
+ width: screen.width,
16
+ height: element.offsetHeight,
17
+ seed: seed
18
+ });
19
+ element.appendChild(pattern.canvas());
20
+ }
21
+
22
+ setRandomBgImage('{{ selector }}', '{{ seed }}');
23
+ </script>
@@ -0,0 +1,12 @@
1
+ {% assign split_mark = '<|>' %}
2
+
3
+ {% assign categories = '' %}
4
+ {% for category in site.categories %}
5
+ {% assign name = category | first %}
6
+ {% assign categories = categories | append: split_mark | append: name %}
7
+ {% endfor %}
8
+
9
+ {% assign return = categories
10
+ | remove_first: split_mark
11
+ | split: split_mark
12
+ | sort: self %}
@@ -0,0 +1,18 @@
1
+ {% if include.filter %}
2
+ {% assign filter = include.filter %}
3
+ {% endif %}
4
+
5
+ {% assign split_mark = '<|>' %}
6
+
7
+ {% assign dates = '' %}
8
+ {% for post in site.posts %}
9
+ {% assign name = post.date | date: filter %}
10
+ {% assign dates = dates | append: split_mark | append: name %}
11
+ {% endfor %}
12
+
13
+ {% assign return = dates
14
+ | remove_first: split_mark
15
+ | split: split_mark
16
+ | sort: self
17
+ | uniq %}
18
+
@@ -0,0 +1,12 @@
1
+ {% assign split_mark = '<|>' %}
2
+
3
+ {% assign tags = '' %}
4
+ {% for tag in site.tags %}
5
+ {% assign name = tag | first %}
6
+ {% assign tags = tags | append: split_mark | append: name %}
7
+ {% endfor %}
8
+
9
+ {% assign return = tags
10
+ | remove_first: split_mark
11
+ | split: split_mark
12
+ | sort: self %}
@@ -0,0 +1,19 @@
1
+ {%- if include.name -%}
2
+ {%- assign name = include.name -%}
3
+ {%- endif -%}
4
+
5
+ {%- assign return = include.return -%}
6
+
7
+ {%- if page[name] -%}
8
+ {%- assign return = page[name] -%}
9
+ {%- elsif site[name] -%}
10
+ {%- assign return = site[name] -%}
11
+ {%- elsif site.data[name] -%}
12
+ {%- assign return = site.data[name] -%}
13
+ {%- elsif site.defaults[page.layout][name] -%}
14
+ {%- assign return = site.defaults[page.layout][name] -%}
15
+ {%- elsif site.data.defaults[page.layout][name] -%}
16
+ {%- assign return = site.data.defaults[page.layout][name] -%}
17
+ {%- elsif layout[name] -%}
18
+ {%- assign return = layout[name] -%}
19
+ {%- endif -%}
@@ -0,0 +1,17 @@
1
+ {% if include.level %}
2
+ {% assign level = include.level %}
3
+ {% endif %}
4
+
5
+ {% if include.msg %}
6
+ {% assign msg = include.msg %}
7
+ {% endif %}
8
+
9
+ {% if site.debug == true %}
10
+ {% if level == 'debug' %}
11
+ {% if jekyll.environment == "development" %}
12
+ <!-- {{ msg }} -->
13
+ {% endif %}
14
+ {% else %}
15
+ <!-- {{ msg }} -->
16
+ {% endif %}
17
+ {% endif %}
@@ -0,0 +1,25 @@
1
+ {%- if include.func -%}
2
+ {%- assign func = include.func -%}
3
+ {%- endif -%}
4
+
5
+ {%- assign include_path = func -%}
6
+ {%- assign path_array = include_path | split: '.' -%}
7
+ {%- if path_array.size == 1 -%}
8
+ {%- assign include_path = include_path | append: '.html' -%}
9
+ {%- endif -%}
10
+
11
+ {%- if func == 'log' -%}
12
+ {%- include functions/log.html level=include.level msg=include.msg -%}
13
+ {%- else -%}
14
+ {%- assign include_path = 'functions/' | append: include_path -%}
15
+ {%- include {{ include_path }} -%}
16
+ {%- endif -%}
17
+
18
+ {%- if func != 'log' -%}
19
+ {%- assign msg = '[function]['
20
+ | append: {{func}}
21
+ | append: '] '
22
+ | append: {{return}}
23
+ -%}
24
+ {%- include functions.html func='log' level='info' -%}
25
+ {%- endif -%}
@@ -0,0 +1,16 @@
1
+ <head>
2
+ <meta charset="utf-8">
3
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta name="google-translate-customization" content="108d9124921d80c3-80e20d618ff053c8-g4f02ec6f3dba68b7-c"></meta>
6
+ {%- seo -%}
7
+ {%- if site.favicon -%}
8
+ <link rel="shortcut icon" href="{{ site.favicon }}">
9
+ {%- endif -%}
10
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
11
+ <link rel="stylesheet" href="{{ "/assets/main.css" | relative_url }}">
12
+ {%- feed_meta -%}
13
+ {%- if jekyll.environment == 'production' and site.google_analytics -%}
14
+ {%- include google-analytics.html -%}
15
+ {%- endif -%}
16
+ </head>
@@ -0,0 +1,10 @@
1
+ {%- include functions.html func='log' level='debug' msg='Get datetimes value' -%}
2
+
3
+ {% assign filter = '%Y' %}
4
+ {% include functions.html func='get_datetimes' %}
5
+ {% assign datetimes = return %}
6
+
7
+ {% assign keys = datetimes %}
8
+ {% assign field = 'date' %}
9
+ {% assign url = '/archives.html' %}
10
+ {% include sidebar/common-list.html %}
@@ -0,0 +1,59 @@
1
+ <style type="text/css" media="screen">
2
+ .post-menu ul {
3
+ list-style: none;
4
+ padding: 0;
5
+ margin: 0;
6
+ }
7
+ </style>
8
+
9
+ <div class="post-menu">
10
+ <div class="post-menu-title">Contents</div>
11
+ <div class="post-menu-content"></div>
12
+ </div>
13
+
14
+ <script>
15
+ var menu = document.querySelector(".post-menu .post-menu-content");
16
+ var headings = document.querySelector(".post-content").querySelectorAll("h2, h3, h4, h5, h6");
17
+
18
+ // Generate post menu
19
+ var menuHTML = '';
20
+ headings.forEach(function (h) {
21
+ menuHTML += (
22
+ '<li class="h-' + h.tagName.toLowerCase() + '">'
23
+ + '<a href="#h-' + h.getAttribute('id') + '">' + h.textContent + '</a></li>');
24
+ });
25
+
26
+ menu.innerHTML = '<ul>' + menuHTML + '</ul>';
27
+
28
+ // The anchor offsetHeight
29
+ var headerHeight = 0;
30
+ var header = document.querySelector('header');
31
+ if (header) {
32
+ offsetHeight = header.offsetHeight + 12;
33
+ }
34
+
35
+ // Active the menu item
36
+ window.addEventListener('scroll', function (event) {
37
+ var lastActive = menu.querySelector('.active');
38
+ var changed = true;
39
+ for (var i = headings.length - 1; i >= 0; i--) {
40
+ var h = headings[i];
41
+ var clientRect = h.getBoundingClientRect();
42
+ if (clientRect.top < offsetHeight) {
43
+ var id = 'h-' + h.getAttribute('id');
44
+ var curActive = menu.querySelector('a[href="#' + id + '"]');
45
+ if (curActive) {
46
+ curActive.classList.add('active');
47
+ }
48
+ if (lastActive == curActive) {
49
+ changed = false;
50
+ }
51
+ break;
52
+ }
53
+ }
54
+ if (lastActive && changed) {
55
+ lastActive.classList.remove('active');
56
+ }
57
+ event.preventDefault();
58
+ });
59
+ </script>
@@ -0,0 +1,9 @@
1
+ {%- include functions.html func='log' level='debug' msg='Get categories value' -%}
2
+
3
+ {%- include functions.html func='get_categories' -%}
4
+ {% assign categories = return %}
5
+
6
+ {% assign keys = categories %}
7
+ {% assign field = 'categories' %}
8
+ {% assign url = '/categories.html' %}
9
+ {% include sidebar/common-list.html %}
@@ -0,0 +1,25 @@
1
+ {%- if include.keys -%}
2
+ {%- assign keys = include.keys -%}
3
+ {%- endif -%}
4
+
5
+ {%- if include.field -%}
6
+ {%- assign field = include.field -%}
7
+ {%- endif -%}
8
+
9
+ <div class="common-list">
10
+ <ul>
11
+ <li>
12
+ <a href="/index.html">
13
+ All<span>{{ site.posts.size }}</span>
14
+ </a>
15
+ </li>
16
+
17
+ {% for key in keys %}
18
+ <li>
19
+ <a href="{{ url }}#h-{{ key }}">
20
+ {{ key }} <span>{{ site.posts | where: field, key | size }}</span>
21
+ </a>
22
+ </li>
23
+ {% endfor %}
24
+ </ul>
25
+ </div>
@@ -0,0 +1,3 @@
1
+ <div>
2
+ {%- include extensions/google-translate.html -%}
3
+ </div>
@@ -0,0 +1,9 @@
1
+ {%- include functions.html func='log' level='debug' msg='Get tags value' -%}
2
+
3
+ {%- include functions.html func='get_tags' -%}
4
+ {% assign tags = return %}
5
+
6
+ {% assign keys = tags %}
7
+ {% assign field = 'tags' %}
8
+ {% assign url = '/tags.html' %}
9
+ {%- include sidebar/common-list.html -%}
@@ -0,0 +1,11 @@
1
+ <article class="post h-entry" itemscope itemtype="http://schema.org/BlogPosting">
2
+
3
+ <div class="post-content e-content" itemprop="articleBody">
4
+
5
+ {{ content }}
6
+
7
+ </div>
8
+
9
+ <div>
10
+
11
+ </article>