Update meta tags

This commit is contained in:
Rico Sta. Cruz 2015-03-13 02:59:13 +08:00
parent 79b208b204
commit 4fc101def2
9 changed files with 103 additions and 88 deletions

View File

@ -1,4 +1,5 @@
--- ---
type: article
--- ---
{% include head.html %} {% include head.html %}
{% include site-header.html %} {% include site-header.html %}

View File

@ -6,7 +6,7 @@ html_class: home
<div class='pages-list'> <div class='pages-list'>
{% for page in site.pages %} {% for page in site.pages %}
<a href=".{{ page.url }}"> <a href="{{base}}{{ page.url }}">
<span class='title'>{{ page.title }}</span> <span class='title'>{{ page.title }}</span>
<span class='date'>{{ page.url }}</span> <span class='date'>{{ page.url }}</span>
</a> </a>

View File

@ -11,14 +11,6 @@ kramdown:
input: GFM input: GFM
hard_wrap: false hard_wrap: false
parse_block_html: true parse_block_html: true
use_coderay: true
coderay:
coderay_line_numbers: nil
coderay_line_numbers_start: 1
coderay_tab_width: 4
coderay_bold_every: 10
coderay_css: class
defaults: defaults:
- scope: - scope:
@ -28,13 +20,9 @@ defaults:
# Site info # Site info
url: http://ricostacruz.com/cheatsheets url: http://ricostacruz.com/cheatsheets
meta: title: Cheatsheets
name: "Cheatsheets"
title: Cheatsheets
description: "A collection of cheatsheets I've written."
hostname: ricostacruz.com
author: Rico Sta. Cruz
# Google analytics # Google analytics
analytics: analytics:
hostname: ricostacruz.com
id: "UA-20473929-1" id: "UA-20473929-1"

View File

@ -1,7 +1,7 @@
<div class="about-the-site"> <div class="about-the-site">
<div class="container"> <div class="container">
<p class='blurb'> <p class='blurb'>
<strong><a href="{{ site.url }}">Cheatsheets</a></strong> is a collection of cheatsheets I've written over the years. <strong><a href="{{ base }}">Cheatsheets</a></strong> is a collection of cheatsheets I've written over the years.
Suggestions and corrections? <a href='https://github.com/rstacruz/cheatsheets/issues'>Send them in</a>. Suggestions and corrections? <a href='https://github.com/rstacruz/cheatsheets/issues'>Send them in</a>.
<i class='fleuron'></i> <i class='fleuron'></i>
I'm <a href="http://ricostacruz.com">Rico Sta. Cruz</a>. I'm <a href="http://ricostacruz.com">Rico Sta. Cruz</a>.

View File

@ -1,77 +1,9 @@
<!doctype html> <!doctype html>
<html lang='en' class='{{ page.html_class }}'> <html lang='en' class='{{ page.html_class }}'>
<head> <head>
<meta charset='utf-8'> {% include meta.html %}
{% if page.title %}
<title>{{ page.title }} &mdash; {{ site.meta.title }}</title>
<meta content='{{ page.title }}' property='og:title'>
<meta content='{{ page.title }}' property='twitter:title'>
<meta content='article' property='og:type'>
{% else %}
<title>{{ site.meta.title }}</title>
<meta content='{{ site.meta.title }}' property='og:title'>
<meta content='{{ site.meta.title }}' property='twitter:title'>
<meta content='blog' property='og:type'>
{% endif %}
{% if page.description %}
<meta content="{{ page.description }}" name="description">
<meta content="{{ page.description }}" property="og:description">
{% else if page.url == '/index.html' && site.meta.description %}
<meta content="{{ site.meta.description }}" name="description">
<meta content="{{ site.meta.description }}" property="og:description">
{% endif %}
{% if page.url != '/index.html' %}
<link rel="canonical" href="{{ site.meta.url }}{{ page.url }}">
<meta name="og:url" content="{{ site.meta.url }}{{ page.url }}">
<link rel="prefetch" href="{{ site.meta.url }}">
<link rel="prerender" href="{{ site.meta.url }}">
{% endif %}
{% if page.author %}
{% for author in site.authors | where: "name", page.author %}
<meta content='{{ author.name }}' name='author'>
{% if author.ogp %}
<meta content='{{ author.ogp }}' property='article:author'>
{% endif %}
{% endfor %}
{% endif %}
{% if site.meta.title %}
<meta content='{{ site.meta.title }}' property='og:site_name'>
{% endif %}
{% if site.facebook.app_id %}
<meta content='{{ site.facebook.app_id }}' property='fb:app_id'>
{% endif %}
{% if site.facebook.admin %}
<meta content='{{ site.facebook.admin }}' property='fb:admins'>
{% endif %}
{% if page.date %}
<meta content='{{ page.date | date: "%Y-%m-%d" }}' property='article:published_date'>
{% endif %}
{% if page.image %}
<meta content='{{ page.image }}' property='og:image'>
<meta content='{{ page.image }}' name='twitter:image'>
{% endif %}
{% if page.tags[0] %}
<meta content='{{ page.tags[0] }}' property='article:section'>
{% endif %}
{% if page.tags %}
{% for tag in page.tags %}
<meta content='{{ tag }}' property='article:tag'>
{% endfor %}
{% endif %}
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
<link href='/favicon.png' rel='shortcut icon'>
{% if site.analytics %}<script>if(~location.hostname.indexOf("{{site.meta.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 %}
<link href="http://ricostacruz.com/til/assets/style.css?t={{ site.time | date: "%Y%m%d%H%M%S" }}" rel="stylesheet" /> <link href="http://ricostacruz.com/til/assets/style.css?t={{ site.time | date: "%Y%m%d%H%M%S" }}" rel="stylesheet" />
<link href="assets/style.css?t={{ site.time | date: "%Y%m%d%H%M%S" }}" rel="stylesheet" /> <link href="{{base}}/assets/style.css?t={{ site.time | date: "%Y%m%d%H%M%S" }}" rel="stylesheet" />
</head> </head>
<body> <body>
<div class='all'> <div class='all'>

91
_includes/meta.html Normal file
View File

@ -0,0 +1,91 @@
<meta charset='utf-8'>
{%comment%}<!-- set the base -->{%endcomment%}
{% assign base = '' %}
{% assign depth = page.url | split: '/' | size | minus: 1 %}
{% if depth == 1 %}{% assign base = '.' %}
{% elsif depth == 2 %}{% assign base = '..' %}
{% elsif depth == 3 %}{% assign base = '../..' %}
{% elsif depth == 4 %}{% assign base = '../../..' %}{% endif %}
{% assign timestamp = site.time | date: "%Y%m%d%H%M%S" %}
{%comment%}<!-- title -->{%endcomment%}
{% if page.full_title %}
<title>{{ page.full_title }}</title>
<meta content='{{ page.full_title }}' property='og:title'>
<meta content='{{ page.full_title }}' property='twitter:title'>
<meta content='article' property='og:type'>
{% elsif page.title %}
<title>{{ page.title }} &mdash; {{ site.title }}</title>
<meta content='{{ page.title }}' property='og:title'>
<meta content='{{ page.title }}' property='twitter:title'>
<meta content='{{ page.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'>
{% endif %}
{%comment%}<!-- description -->{%endcomment%}
{% if page.description %}
<meta content="{{ page.description }}" name="description">
<meta content="{{ page.description }}" property="og:description">
{% endif %}
{%comment%}<!-- canonical URL -->{%endcomment%}
{% if page.url != '/index.html' %}
<link rel="canonical" href="{{ site.url }}{{ page.url }}">
<meta name="og:url" content="{{ site.url }}{{ page.url }}">
<link rel="prefetch" href="{{ site.url }}">
<link rel="prerender" href="{{ site.url }}">
{% endif %}
{%comment%}<!-- author -->{%endcomment%}
{% if page.author %}
{% for author in site.authors | where: "name", page.author %}
<meta content='{{ author.name }}' name='author'>
{% if author.ogp %}
<meta content='{{ author.ogp }}' property='article:author'>
{% endif %}
{% endfor %}
{% endif %}
{%comment%}<!-- site name -->{%endcomment%}
{% if site.title %}
<meta content='{{ site.title }}' property='og:site_name'>
{% endif %}
{%comment%}<!-- facebook -->{%endcomment%}
{% if site.facebook.app_id %}
<meta content='{{ site.facebook.app_id }}' property='fb:app_id'>
{% endif %}
{% if site.facebook.admin %}
<meta content='{{ site.facebook.admin }}' property='fb:admins'>
{% endif %}
{%comment%}<!-- page meta -->{%endcomment%}
{% if page.date %}
<meta content='{{ page.date | date: "%Y-%m-%d" }}' property='article:published_date'>
{% endif %}
{% if page.image %}
<meta content='{{ page.image }}' property='og:image'>
<meta content='{{ page.image }}' name='twitter:image'>
{% endif %}
{%comment%}<!-- tags -->{%endcomment%}
{% if page.tags[0] %}
<meta content='{{ page.tags[0] }}' property='article:section'>
{% endif %}
{% if page.tags %}
{% for tag in page.tags %}
<meta content='{{ tag }}' property='article:tag'>
{% endfor %}
{% endif %}
{%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 %}
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
<meta content='width=device-width, initial-scale=1.0' name='viewport'>
<link href='{{ base }}/assets/favicon.png' rel='shortcut icon'>

View File

@ -1,6 +1,6 @@
<div class='site-header'> <div class='site-header'>
<div class='container'> <div class='container'>
This is <a href="."><em>{{ site.meta.name }}</em></a> &mdash; a collection of cheatsheets I've written. This is <a href="."><em>{{ site.title }}</em></a> &mdash; a collection of cheatsheets I've written.
</div> </div>
</div> </div>

View File

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

View File

@ -145,6 +145,7 @@ Markup
### If ### If
{% if page.image.feature %} {% if page.image.feature %}
{% else if xyz %}
{% else %} {% else %}
{% endif %} {% endif %}