Skip to content

Commit

Permalink
Implement 'type' metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
rstacruz committed Sep 4, 2017
1 parent 20784d4 commit 0188226
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 26 deletions.
3 changes: 2 additions & 1 deletion 404.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
layout: 2017/not_found
type: error
permalink: /404.html
---
This cheatsheet doesn't exist.
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
```

Expand Down
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ defaults:
type: pages
values:
layout: "default"
og_type: article
type: article
category: "Others"
excerpt_separator: "<!--more-->"
Expand Down
7 changes: 6 additions & 1 deletion _data/content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion _includes/2017/search-form.html
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
10 changes: 8 additions & 2 deletions _includes/2017/top-nav.html
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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' }}'>
Expand Down
4 changes: 2 additions & 2 deletions _includes/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -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%}
Expand Down
2 changes: 1 addition & 1 deletion _includes/social-list.html
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down
5 changes: 1 addition & 4 deletions _layouts/2017/home.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
---
type: website
---
{% assign featured_pages = site.pages
| where_exp: "page", "page.tags contains 'Featured'"
%}
Expand All @@ -9,7 +6,7 @@
| 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'>
Expand Down
14 changes: 3 additions & 11 deletions _layouts/2017/not_found.html
Original file line number Diff line number Diff line change
@@ -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>
Expand Down
1 change: 1 addition & 0 deletions _layouts/2017/sheet.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
og_type: article
type: article
---
{% include 2017/head.html %}
Expand Down
1 change: 1 addition & 0 deletions _layouts/home.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
html_class: home
type: home
---
{% include head.html %}
{% include site-header.html %}
Expand Down
4 changes: 2 additions & 2 deletions index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
3 changes: 2 additions & 1 deletion index@2016.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
---

0 comments on commit 0188226

Please sign in to comment.