Skip to content

Commit

Permalink
add keywords variable in front-matter and hexo configuration file - #182
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBarranqueiro committed Dec 16, 2015
1 parent d9c72f2 commit 82e199e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ If you want to report a bug or ask a question, [create an issue](https://github.
* [Enable post assets folder](#enable-post-assets-folder)
* [Disable relative links](#disable-relative-links)
* [Enable RSS feed](#enable-rss-feed)
* [Define global keywords](#define-global-keywords)
- [Tranquilpeak configuration](#tranquilpeak-configuration)
- [Languages configuration](#languages-configuration)
- [Theme configuration](#theme-configuration)
Expand Down Expand Up @@ -128,6 +129,16 @@ feed:

If you want more informations on this plugin : [hexo-generator-feed](https://github.com/hexojs/hexo-generator-feed)

### Define global keywords ###

You can define keywords for search engines. These keywords will be added on all pages.

``` yaml
keywords:
- hexo
- javascript
```

## Tranquilpeak configuration ##

### Language configuration ###
Expand Down Expand Up @@ -419,6 +430,9 @@ Tranquilpeak introduces new variables to give you a lot of possibilities.

Example :
``` markdown
keywords:
- javascript
- hexo
clearReading: true
thumbnailImage: image-1.png
thumbnailImagePosition: bottom
Expand All @@ -436,6 +450,7 @@ photos:
comments: false
```

- **keywords** : Define keywords for search engines. you can also define global keywords in Hexo configuration file.
- **clearReading** : Hide sidebar on all article page to let article take full width to improve reading, and enjoy wide images and cover images. Useless if `theme.sidebar_behavior` is equal to `3` or `4`. (true: enable, false: disable). Default behavior : `theme.clear_reading` value in theme configuration file.
- **autoThumbnailImage** : Automatically select the cover image or the first photo from the gallery of a post if there is no thumbnail image as the thumbnail image. `autoThumbnailImage` overwrite the setting `auto_thumbnail_image` in the theme configuration file
- **thumbnailImage** : Image displayed in index view.
Expand Down
17 changes: 17 additions & 0 deletions layout/_partial/head.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var title = '';
var title_suffix = ' - ' + config.title;
var fb_admin_ids = [];
var keywords = '';
/**
* Separate fb admin ids
Expand Down Expand Up @@ -55,13 +56,29 @@
title += page.title + title_suffix;
}
})();
/**
* Get global and page keywords
*/
(function() {
if (config.keywords) {
keywords += config.keywords;
keywords += ',';
}
if (page.keywords) {
keywords += page.keywords;
}
})();
%>
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" >
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="generator" content="<%= config.title %>">
<title><%= title %></title>
<meta name="author" content="<%= config.author %>">
<% if (keywords) { %>
<meta name="keywords" content="<%= keywords %>">
<% } %>
<% if (theme.favicon) { %>
<link rel="icon" href="<%= resolve_asset_url(theme.image_dir, theme.favicon) %>">
<% } %>
Expand Down

0 comments on commit 82e199e

Please sign in to comment.