diff --git a/_config.yml.example b/_config.yml.example
index 44ecb9d..decaf6f 100644
--- a/_config.yml.example
+++ b/_config.yml.example
@@ -39,7 +39,7 @@ profile:
description:
social:
github:
- facebook:
+ facebook: # Facebook property also used in `article:author` meta tag.
linkedin:
instagram:
twitter:
diff --git a/layout/includes/article.jade b/layout/includes/article.jade
index e0fcbb8..589a9b3 100644
--- a/layout/includes/article.jade
+++ b/layout/includes/article.jade
@@ -13,16 +13,7 @@ article#article.article(itemscope itemtype="https://schema.org/BlogPosting")
)= category.name
unless index === page.categories.length - 1
span.article__meta__categories__separator >
- if page.banner && page.banner.url
- img.article__image(
- src=page.banner.url
- alt="Post Image")
- else if page.photos && page.photos.length
- each photo in page.photos
- img.article__image(
- src=photo
- alt="Gallery Image")
- else
+ unless (page.banner && page.banner.url) || (page.photos && page.photos.length)
hr
.article__contents
diff --git a/layout/includes/head.jade b/layout/includes/head.jade
index 896cfab..a5ec6e7 100644
--- a/layout/includes/head.jade
+++ b/layout/includes/head.jade
@@ -5,7 +5,7 @@
- if (is_month()) pageTitle += ': ' + page.month + '/' + page.year;
- if (is_year()) pageTitle += ': ' + page.year;
- pageTitle = pageTitle ? pageTitle += ' | ' + config.title : config.title;
-- var banner = page.banner ? page.banner.url : (page.photos ? page.photos[0] : theme.default.url);
+- var banner = bannerOf(page) || theme.default.url;
-
var openGraph = open_graph({
description: page.content || config.description || theme.profile.description,
@@ -17,6 +17,7 @@
});
meta(charset='UTF-8')
+meta(http-equiv="X-UA-Compatible" content="IE=edge")
meta(name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1")
title= pageTitle
@@ -37,6 +38,8 @@ link(rel="stylesheet" href="/css/index.css")
| !{ canonical(config, page) }
| !{ openGraph }
+if is_post()
+ meta(property="article:author" content=theme.profile.social.facebook || config.author)
if theme.favicon
link(rel="icon" href=theme.favicon)
diff --git a/layout/includes/post-list.jade b/layout/includes/post-list.jade
index 7728bb7..8faaf88 100644
--- a/layout/includes/post-list.jade
+++ b/layout/includes/post-list.jade
@@ -42,7 +42,7 @@ section.post-list
article.post-list__item
.post-list__item__col-1
a.post-list__item__link(href=url_for(post.path))
- - var banner = post.banner ? post.banner.url : (post.photos[0] || theme.default.url)
+ - var banner = bannerOf(post) || theme.default.url;
.post-list__item__link__background(style="background-image: url('#{ banner }')")
.post-list__item__col-2
.post-list__item__meta
diff --git a/layout/post.jade b/layout/post.jade
index 9cce1b0..aad659b 100644
--- a/layout/post.jade
+++ b/layout/post.jade
@@ -11,7 +11,7 @@ block content
each post in relatedPosts
.related-posts__item__wrapper
a.related-posts__item(href=url_for(post.path))
- - var banner = post.banner ? post.banner.url : ((post.photos && post.photos.length) ? post.photos[0] : theme.default.url);
+ - var banner = bannerOf(post) || theme.default.url;
.related-posts__item__background(style="background-image: url('#{ banner }')")
.related-posts__item__overlay
span.related-posts__item__title= post.title || 'Untitled'
diff --git a/scripts/banner.js b/scripts/banner.js
new file mode 100644
index 0000000..497cf9e
--- /dev/null
+++ b/scripts/banner.js
@@ -0,0 +1,18 @@
+/**
+ * Banner Helper
+ * @description Get banner url from post.
+ * @example
+ * bannerOf(post);
+ */
+
+hexo.extend.helper.register('bannerOf', function (post) {
+ var url = post.banner ? post.banner.url : (post.photos && post.photos.length ? post.photos[0] : '');
+ var imgRegex = /\
/ig;
+ if (!url) {
+ var result = imgRegex.exec(post.content);
+ if (result && result.length > 1) {
+ url = result[1];
+ }
+ }
+ return url;
+});
diff --git a/scripts/before_post_render.js b/scripts/before_post_render.js
new file mode 100644
index 0000000..004e463
--- /dev/null
+++ b/scripts/before_post_render.js
@@ -0,0 +1,18 @@
+/**
+ * Filter triggered by post rendering.
+ */
+
+function imgTpl(url) {
+ return '
';
+}
+
+hexo.extend.filter.register('before_post_render', function (data) {
+ if (data.banner) {
+ var img = imgTpl(data.banner.url);
+ data.content = img + data.content;
+ } else if (data.photos && data.photos.length) {
+ var imgs = data.photos.map(imgTpl).join('');
+ data.content += imgs + data.content;
+ }
+ return data;
+});
diff --git a/source/css/code.scss b/source/css/code.scss
index 2c3aafb..1d8788d 100644
--- a/source/css/code.scss
+++ b/source/css/code.scss
@@ -13,16 +13,24 @@
}
.keyword,
.selector-tag,
- .literal,
.section,
.link {
- color: #8be9fd;
+ color: #ff79c6;
+ }
+ .literal,
+ .number {
+ color: #bd93f9;
}
.function .keyword {
- color: #ff79c6;
+ color: #8be9fd;
+ }
+ .title {
+ color: #50fa7b;
+ }
+ .params {
+ color: #ffb86c;
}
.string,
- .title,
.name,
.type,
.attribute,
@@ -51,7 +59,10 @@
.strong {
font-weight: bold;
}
- .emphasis {
+ .emphasis, .built_in {
font-style: italic;
}
+ .built_in {
+ color: #8be9fd;
+ }
}