From 2cea0ace733caddd5ad5fe0cee63de91be74043e Mon Sep 17 00:00:00 2001 From: Bensong Liu Date: Wed, 14 Oct 2020 11:41:16 +0800 Subject: [PATCH 1/2] bug fix: disqus always want absolute url, so a relative url in config.site.url breaks disqus. --- system/includes/functions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/includes/functions.php b/system/includes/functions.php index 9e8cfd6..cc641c8 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -1858,9 +1858,14 @@ function disqus($title = null, $url = null) $disqus = config('disqus.shortname'); $script = << + var getAbsolutePath = function(href) { + var link = document.createElement('__dummy_get_absolute_path'); + link.href = href; + return link.href; + }; var disqus_shortname = '{$disqus}'; var disqus_title = '{$title}'; - var disqus_url = '{$url}'; + var disqus_url = getAbsolutePath('{$url}'); (function () { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; From eff6949ac53b5a0bfb4be786d082d07094cb8172 Mon Sep 17 00:00:00 2001 From: Bensong Liu Date: Wed, 14 Oct 2020 11:54:42 +0800 Subject: [PATCH 2/2] bug fix: disqus always want absolute url, so a relative url in config.site.url breaks disqus. --- system/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/includes/functions.php b/system/includes/functions.php index cc641c8..665c683 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -1859,7 +1859,7 @@ function disqus($title = null, $url = null) $script = << var getAbsolutePath = function(href) { - var link = document.createElement('__dummy_get_absolute_path'); + var link = document.createElement('a'); link.href = href; return link.href; };