Skip to content

Commit

Permalink
Add options to configure HTML document title (#154)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tony-ho authored and daattali committed Jan 6, 2017
1 parent 86bda5e commit 75f4d87
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -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`.
Expand Down
4 changes: 4 additions & 0 deletions _config.yml
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions _includes/head.html
Expand Up @@ -3,15 +3,15 @@
<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 }}" />

{% if page.subtitle %}
<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 %}
Expand Down
1 change: 1 addition & 0 deletions index.html
Expand Up @@ -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">
Expand Down

0 comments on commit 75f4d87

Please sign in to comment.