Implement 'type' metadata

This commit is contained in:
Rico Sta. Cruz 2017-09-04 10:23:45 +08:00
parent 20784d4b3c
commit 0188226c6e
No known key found for this signature in database
GPG Key ID: CAAD38AE2962619A
14 changed files with 39 additions and 26 deletions

View File

@ -1,4 +1,5 @@
--- ---
layout: 2017/not_found layout: 2017/not_found
type: error
permalink: /404.html
--- ---
This cheatsheet doesn't exist.

View File

@ -54,6 +54,14 @@ ads: false # Add this to disable ads
weight: -5 # lower number = higher in related posts list weight: -5 # lower number = higher in related posts list
deprecated: true # Don't show in related posts deprecated: true # Don't show in related posts
prism_languages: [vim] # Extra syntax highlighting prism_languages: [vim] # Extra syntax highlighting
tags:
- WIP
- Featured
# Special pages:
# (don't set these for cheatsheets)
type: home # home | article | error
og_type: website # opengraph type
--- ---
``` ```

View File

@ -36,6 +36,7 @@ defaults:
type: pages type: pages
values: values:
layout: "default" layout: "default"
og_type: article
type: article type: article
category: "Others" category: "Others"
excerpt_separator: "<!--more-->" excerpt_separator: "<!--more-->"

View File

@ -11,7 +11,7 @@ sheet:
suffix: cheatsheet suffix: cheatsheet
social_list: social_list:
default_description: "Grand collection of web development cheatsheets" default_description: "Ridiculous collection of web development cheatsheets"
description: "The ultimate cheatsheet for TITLE." description: "The ultimate cheatsheet for TITLE."
facebook_share: Share on Facebook facebook_share: Share on Facebook
twitter_share: Share on Twitter twitter_share: Share on Twitter
@ -33,3 +33,8 @@ search_form:
comments_area: comments_area:
suffix: for this cheatsheet. suffix: for this cheatsheet.
link: "Write yours!" link: "Write yours!"
not_found:
title: Not found
description: Sorry, we don't have a cheatsheet for this yet. Try searching!
home: Back to home

View File

@ -1,6 +1,6 @@
<form <form
{% if include.live %}data-js-search-form{% endif %} {% if include.live %}data-js-search-form{% endif %}
class='search'action='{{ base }}' method='get'> class='search' action='{{ base }}' method='get'>
<label class='search-box {{ include.class }}'> <label class='search-box {{ include.class }}'>
{% comment %} {% comment %}
<span class='prefix'>{{ site.data.content.search_form.prefix }}</span> <span class='prefix'>{{ site.data.content.search_form.prefix }}</span>

View File

@ -1,6 +1,12 @@
{% comment %}
Params:
- noshare
- noedit
- noback
{% endcomment %}
<nav class='top-nav'> <nav class='top-nav'>
<div class='container'> <div class='container'>
{% unless include.is_home %} {% unless include.page.noback %}
<div class='left'> <div class='left'>
<a class='home back-button' href='{{base}}'></a> <a class='home back-button' href='{{base}}'></a>
</div> </div>
@ -14,7 +20,7 @@
<div class='actions'> <div class='actions'>
{% include social-list.html class="social page-actions" page=include.page %} {% include social-list.html class="social page-actions" page=include.page %}
{% unless include.is_home %} {% unless include.noedit %}
<ul class='page-actions'> <ul class='page-actions'>
<li class='link github -button hint--bottom' data-hint='{{ site.data.content.top_nav.edit_on_github }}'> <li class='link github -button hint--bottom' data-hint='{{ site.data.content.top_nav.edit_on_github }}'>
<a href='{{ site.github.repository_url }}/blob/gh-pages/{{ page.path | remove: '.html' }}'> <a href='{{ site.github.repository_url }}/blob/gh-pages/{{ page.path | remove: '.html' }}'>

View File

@ -20,12 +20,12 @@
<title>{{ page.title }} cheatsheet</title> <title>{{ page.title }} cheatsheet</title>
<meta content='{{ page.title }}' property='og:title'> <meta content='{{ page.title }}' property='og:title'>
<meta content='{{ page.title }}' property='twitter:title'> <meta content='{{ page.title }}' property='twitter:title'>
<meta content='{{ page.type | default: "article" }}' property='og:type'> <meta content='{{ page.og_type | default: "article" }}' property='og:type'>
{% else %} {% else %}
<title>{{ site.title }}</title> <title>{{ site.title }}</title>
<meta content='{{ site.title }}' property='og:title'> <meta content='{{ site.title }}' property='og:title'>
<meta content='{{ site.title }}' property='twitter:title'> <meta content='{{ site.title }}' property='twitter:title'>
<meta content='{{ page.type | default: "website" }}' property='og:type'> <meta content='{{ page.og_type | default: "website" }}' property='og:type'>
{% endif %} {% endif %}
{%comment%}<!-- description -->{%endcomment%} {%comment%}<!-- description -->{%endcomment%}

View File

@ -1,4 +1,4 @@
{% if include.page.home %} {% if include.page.type == 'home' %}
{% assign description = site.data.content.social_list.default_description %} {% assign description = site.data.content.social_list.default_description %}
{% else %} {% else %}
{% assign description = site.data.content.social_list.description | replace: "TITLE", include.page.title %} {% assign description = site.data.content.social_list.description | replace: "TITLE", include.page.title %}

View File

@ -1,6 +1,3 @@
---
type: website
---
{% assign featured_pages = site.pages {% assign featured_pages = site.pages
| where_exp: "page", "page.tags contains 'Featured'" | where_exp: "page", "page.tags contains 'Featured'"
%} %}
@ -9,7 +6,7 @@ type: website
| sort: "updated", "first" | sort: "updated", "first"
%} %}
{% include 2017/head.html %} {% include 2017/head.html %}
{% include 2017/top-nav.html page=page is_home=true %} {% include 2017/top-nav.html page=page is_home=true noedit=true noback=true %}
{% if site.data.carbon.enabled %} {% if site.data.carbon.enabled %}
<div class='SideAd'> <div class='SideAd'>

View File

@ -1,23 +1,15 @@
---
type: website
permalink: /404.html
---
{% include 2017/head.html %} {% include 2017/head.html %}
{% include 2017/top-nav.html page=page noshare=true %} {% include 2017/top-nav.html page=page noshare=true %}
<div class='body-area -slim'> <div class='body-area -slim'>
<div class='site-header'> <div class='site-header'>
<h1> <h1>{{ site.data.content.not_found.title }}</h1>
Not found <p>{{ site.data.content.not_found.description }}</p>
</h1>
<p>
Sorry, we don't have a cheatsheet for this yet. Try searching!
</p>
{% include 2017/search-form.html %} {% include 2017/search-form.html %}
<p class='action'> <p class='action'>
<a class='push-button' href='./'>Back to home</a> <a class='push-button' href='./'>{{ site.data.content.not_found.home }}</a>
</p> </p>
</div> </div>
</div> </div>

View File

@ -1,4 +1,5 @@
--- ---
og_type: article
type: article type: article
--- ---
{% include 2017/head.html %} {% include 2017/head.html %}

View File

@ -1,5 +1,6 @@
--- ---
html_class: home html_class: home
type: home
--- ---
{% include head.html %} {% include head.html %}
{% include site-header.html %} {% include site-header.html %}

View File

@ -2,6 +2,6 @@
full_title: "Cheatsheets — for web development and more" full_title: "Cheatsheets — for web development and more"
description: "A collection of cheatsheets I've written." description: "A collection of cheatsheets I've written."
layout: 2017/home layout: 2017/home
type: website og_type: website
home: true type: home
--- ---

View File

@ -2,5 +2,6 @@
full_title: "Cheatsheets — for web development and more" full_title: "Cheatsheets — for web development and more"
description: "A collection of cheatsheets I've written." description: "A collection of cheatsheets I've written."
layout: home layout: home
type: website type: home
og_type: website
--- ---