Add options to configure HTML document title (#154)

* Add option to use site title as HTML document title

* Add configurable title separator character

* Keep old document title behaviour when not using use-site-title
This commit is contained in:
Tony Ho 2017-01-06 19:33:51 +11:00 committed by Dean Attali
parent 86bda5e4da
commit 75f4d8703e
4 changed files with 8 additions and 2 deletions

View File

@ -134,6 +134,7 @@ Parameter | Description
----------- | -----------
title | Page or blog post title
subtitle | Short description of page or blog post that goes under the title
use-site-title | If you want to use the site title rather than page title as HTML document title (ie. browser tab title), use `use-site-title: true`. When set, the document title will take the format `Site Title - Site Description` (eg. `My website - A virtual proof that name is awesome!`). By default, it will use `Page Title` if it exists, or `Site Title` otherwise.
bigimg | Include a large full-width image at the top of the page. You can either give the path to a single image, or provide a list of images to cycle through (see [my personal website](http://deanattali.com/) as an example).
comments | If you want do add Disqus comments to a specific page, use `comments: true`. Comments are automatically enabled on blog posts; to turn comments off for a specific post, use `comments: false`. Comments only work if you set your Disqus id in the `_config.yml` file.
show-avatar | If you have an avatar configured in the `_config.yml` but you want to turn it off on a specific page, use `show-avatar: false`. If you want to turn it off by default, locate the line `show-avatar: true` in the file `_config.yml` and change the `true` to `false`; then you can selectively turn it on in specific pages using `show-avatar: true`.

View File

@ -102,6 +102,10 @@ url-pretty: "MyWebsite.com" # eg. "deanattali.com/beautiful-jekyll"
# Truncates the excerpt to the specified number of words on the index page
excerpt_length: 50
# Character used to separate site title and description in HTML document title
# and RSS feed title
title-separator: "-"
# --- Don't need to touch anything below here (but you can if you want) --- #
# Output options (more information on Jekyll's site)

View File

@ -3,7 +3,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
<title>{% if page.use-site-title %}{{ site.title }} {{ site.title-separator }} {{ site.description }}{% elsif page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}</title>
<meta name="author" content="{{ site.author.name }}" />
@ -11,7 +11,7 @@
<meta name="description" content="{{ page.subtitle }}">
{% endif %}
<link rel="alternate" type="application/rss+xml" title="{{ site.title }} - {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />
<link rel="alternate" type="application/rss+xml" title="{{ site.title }} {{ site.title-separator }} {{ site.description }}" href="{{ site.baseurl }}/feed.xml" />
{% if layout.common-ext-css %}
{% for css in layout.common-ext-css %}

View File

@ -2,6 +2,7 @@
layout: page
title: My website
subtitle: This is where I will tell my friends way too much about me
use-site-title: true
---
<div class="posts-list">