From 388a469409d2c32f3be321cddf1a32cfcd7a8e78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E9=9B=A8=E7=97=95?= Date: Thu, 15 Feb 2018 12:28:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20=E8=AF=84=E8=AE=BA=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E7=9A=84url=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit url_for()生成的是当前页面到path的相对路径,不能用来直接拼接完整url。 使用permallink属性得到完整url --- layout/_partial/article.ejs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/layout/_partial/article.ejs b/layout/_partial/article.ejs index 3722a8fed..6d0da0530 100644 --- a/layout/_partial/article.ejs +++ b/layout/_partial/article.ejs @@ -84,7 +84,7 @@ <%- partial('post/duoshuo', { key: post.slug, title: post.title, - url: config.url+url_for(post.path) + url: post.permalink }) %> <% } %> @@ -92,7 +92,7 @@ <%- partial('post/wangyiyun', { key: post.slug, title: post.title, - url: config.url+url_for(post.path) + url: post.permalink }) %> <% } %> @@ -100,7 +100,7 @@ <%- partial('post/changyan', { key: post.slug, title: post.title, - url: config.url+url_for(post.path) + url: post.permalink }) %> <% } %> @@ -126,7 +126,7 @@ <%- partial('post/gitment', { key: post.slug, title: post.title, - url: config.url+url_for(post.path) + url: post.permalink }) %> <% } %> <% } %> From be17cfbb28bf2c57b4f5ab796129b63bb1661f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E9=9B=A8=E7=97=95?= Date: Thu, 15 Feb 2018 01:59:47 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=86=E7=A6=BBdisqus=E5=88=B0=E7=8B=AC?= =?UTF-8?q?=E7=AB=8B=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 与支持的其他评论系统一样并行,单独成文件 --- layout/_partial/article.ejs | 20 +++++--------------- layout/_partial/post/disqus.ejs | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 layout/_partial/post/disqus.ejs diff --git a/layout/_partial/article.ejs b/layout/_partial/article.ejs index 6d0da0530..5d5f6c8e8 100644 --- a/layout/_partial/article.ejs +++ b/layout/_partial/article.ejs @@ -105,21 +105,11 @@ <% } %> <% if (theme.disqus || config.disqus_shortname){ %> -
-
- - -
+ <%- partial('post/disqus', { + key: post.slug, + title: post.title, + url: post.permalink + }) %> <% } %> <% if (theme.gitment_owner && theme.gitment_repo &&theme.gitment_oauth && theme.gitment_oauth.client_id && theme.gitment_oauth.client_secret){ %> diff --git a/layout/_partial/post/disqus.ejs b/layout/_partial/post/disqus.ejs new file mode 100644 index 000000000..8b7e820aa --- /dev/null +++ b/layout/_partial/post/disqus.ejs @@ -0,0 +1,21 @@ +
+
+ + +
\ No newline at end of file