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
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
deprecated: true # Don't show in related posts
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
values:
layout: "default"
og_type: article
type: article
category: "Others"
excerpt_separator: "<!--more-->"

View File

@ -11,7 +11,7 @@ sheet:
suffix: cheatsheet
social_list:
default_description: "Grand collection of web development cheatsheets"
default_description: "Ridiculous collection of web development cheatsheets"
description: "The ultimate cheatsheet for TITLE."
facebook_share: Share on Facebook
twitter_share: Share on Twitter
@ -33,3 +33,8 @@ search_form:
comments_area:
suffix: for this cheatsheet.
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
{% 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 }}'>
{% comment %}
<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'>
<div class='container'>
{% unless include.is_home %}
{% unless include.page.noback %}
<div class='left'>
<a class='home back-button' href='{{base}}'></a>
</div>
@ -14,7 +20,7 @@
<div class='actions'>
{% include social-list.html class="social page-actions" page=include.page %}
{% unless include.is_home %}
{% unless include.noedit %}
<ul class='page-actions'>
<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' }}'>

View File

@ -20,12 +20,12 @@
<title>{{ page.title }} cheatsheet</title>
<meta content='{{ page.title }}' property='og: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 %}
<title>{{ site.title }}</title>
<meta content='{{ site.title }}' property='og: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 %}
{%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 %}
{% else %}
{% 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
| where_exp: "page", "page.tags contains 'Featured'"
%}
@ -9,7 +6,7 @@ type: website
| sort: "updated", "first"
%}
{% 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 %}
<div class='SideAd'>

View File

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

View File

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

View File

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

View File

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

View File

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