diff --git a/themes/chameleon/layout/_partial/head.ejs b/themes/chameleon/layout/_partial/head.ejs index 87dbf61..93e9af5 100644 --- a/themes/chameleon/layout/_partial/head.ejs +++ b/themes/chameleon/layout/_partial/head.ejs @@ -4,7 +4,7 @@ let title = page.title if (is_archive()) { - title = titlecase(config.archive_dir) + title = titleCase(config.archive_dir) if (is_month()) { title += ': ' + page.year + '/' + page.month diff --git a/themes/chameleon/layout/_partial/post/tag.ejs b/themes/chameleon/layout/_partial/post/tag.ejs index 9937c99..994a87f 100644 --- a/themes/chameleon/layout/_partial/post/tag.ejs +++ b/themes/chameleon/layout/_partial/post/tag.ejs @@ -2,6 +2,6 @@ <%- list_tags(post.tags, { show_count: false, class: 'article-tag', - transform: titlecase + transform: titleCase }) %> <% } %> diff --git a/themes/chameleon/layout/index.ejs b/themes/chameleon/layout/index.ejs index 86a5277..830fc33 100644 --- a/themes/chameleon/layout/index.ejs +++ b/themes/chameleon/layout/index.ejs @@ -10,6 +10,6 @@ <%- list_tags({ amount: 0, class: 'index', - transform: titlecase + transform: titleCase }) %> diff --git a/themes/chameleon/layout/tag-index.ejs b/themes/chameleon/layout/tag-index.ejs index 9265961..757e07c 100644 --- a/themes/chameleon/layout/tag-index.ejs +++ b/themes/chameleon/layout/tag-index.ejs @@ -5,6 +5,6 @@ <%- list_tags({ amount: 0, class: 'index', - transform: titlecase + transform: titleCase }) %> diff --git a/themes/chameleon/scripts/titleCase.js b/themes/chameleon/scripts/titleCase.js new file mode 100644 index 0000000..7540823 --- /dev/null +++ b/themes/chameleon/scripts/titleCase.js @@ -0,0 +1,13 @@ +'use strict' +/* global hexo */ + +/* +* Simpler version of titlecase() https://github.com/rvagg/titlecase +* Does not ignore words with a dot +*/ + +hexo.extend.helper.register('titleCase', (str) => { + return str.replace(/[\w]+[^\s-]*/g, (match) => { + return match.charAt(0).toUpperCase() + match.substr(1) + }) +})