Move categories to _data/

This commit is contained in:
Rico Sta. Cruz 2017-09-04 09:59:06 +08:00
parent 25a20171c6
commit aa84c59dee
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
6 changed files with 10 additions and 49 deletions

View File

@ -1,6 +1,4 @@
#
# Jekyll configuration # Jekyll configuration
#
whitelist: whitelist:
- jekyll-redirect-from - jekyll-redirect-from
@ -18,11 +16,8 @@ exclude:
- Gemfile.lock - Gemfile.lock
- CNAME - CNAME
- vendor - vendor
- _deprecated
#
# Markdown # Markdown
#
highlighter: false highlighter: false
markdown: kramdown markdown: kramdown
@ -33,9 +28,7 @@ kramdown:
syntax_highlighter_opts: syntax_highlighter_opts:
disable: true disable: true
#
# Defaults # Defaults
#
defaults: defaults:
- scope: - scope:
@ -54,47 +47,12 @@ defaults:
- elixir - elixir
- ruby - ruby
#
# Site info # Site info
#
url: http://ricostacruz.com/cheatsheets url: http://ricostacruz.com/cheatsheets
title: Cheatsheets title: Cheatsheets
# # GitHub metadata
# Google analytics
#
#
analytics:
hostname: ricostacruz.com
id: "UA-20473929-1"
#
# Categories
#
category_names:
- Ansible
- Apps
- CLI
- CSS
- Devops
- Elixir
- Git
- HTML
- JavaScript
- JavaScript libraries
- Jekyll
- Ledger
- Markup
- Node.js
- Rails
- React
- Ruby
- Ruby libraries
- Vim
- Fitness
- Others
# https://help.github.com/articles/repository-metadata-on-github-pages/ # https://help.github.com/articles/repository-metadata-on-github-pages/
repository: rstacruz/cheatsheets repository: rstacruz/cheatsheets

0
_data/category.yml Normal file
View File

View File

@ -0,0 +1,3 @@
enabled: true
hostname: ricostacruz.com
id: "UA-20473929-1"

View File

@ -75,8 +75,8 @@
{% endif %} {% endif %}
{%comment%}<!-- tags -->{%endcomment%} {%comment%}<!-- tags -->{%endcomment%}
{% if page.tags[0] %} {% if page.category %}
<meta content='{{ page.tags[0] }}' property='article:section'> <meta content='{{ page.category }}' property='article:section'>
{% endif %} {% endif %}
{% if page.tags %} {% if page.tags %}
{% for tag in page.tags %} {% for tag in page.tags %}
@ -85,7 +85,7 @@
{% endif %} {% endif %}
{%comment%}<!-- google analytics -->{%endcomment%} {%comment%}<!-- google analytics -->{%endcomment%}
{% if site.analytics %}<script>if(~location.hostname.indexOf("{{site.analytics.hostname}}")){var _gaq=_gaq||[];_gaq.push(["_setAccount","{{ site.analytics.id }}"]);_gaq.push(["_trackPageview"]);(function(){var ga=document.createElement("script");ga.async=true;ga.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga,s)})()}</script>{% endif %} {% if site.data.google_analytics.enabled %}<script>if(~location.hostname.indexOf("{{site.data.google_analytics.hostname}}")){var _gaq=_gaq||[];_gaq.push(["_setAccount","{{ site.data.google_analytics.id }}"]);_gaq.push(["_trackPageview"]);(function(){var ga=document.createElement("script");ga.async=true;ga.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(ga,s)})()}</script>{% endif %}
<meta content='IE=edge' http-equiv='X-UA-Compatible'> <meta content='IE=edge' http-equiv='X-UA-Compatible'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'> <meta content='width=device-width, initial-scale=1.0' name='viewport'>

View File

@ -43,7 +43,7 @@ type: website
{% endif %} {% endif %}
{% endfor %} {% endfor %}
{% for category in site.category_names %} {% for category in site.data.category.names %}
<h2 class='category item' id='{{ category | downcase | replace: " ", "-" }}' data-js-searchable-header> <h2 class='category item' id='{{ category | downcase | replace: " ", "-" }}' data-js-searchable-header>
<span>{{ category }}</span> <span>{{ category }}</span>
</h2> </h2>

View File

@ -4,7 +4,7 @@ html_class: home
{% include head.html %} {% include head.html %}
{% include site-header.html %} {% include site-header.html %}
{% for category in site.category_names %} {% for category in site.data.category.names %}
<div class='pages-header'> <div class='pages-header'>
<h2 id='{{ category | downcase | replace: " ", "-" }}'>{{ category }}</h2> <h2 id='{{ category | downcase | replace: " ", "-" }}'>{{ category }}</h2>
</div> </div>