feat: Google Analytics,百度统计
This commit is contained in:
parent
08c9fb777e
commit
d7cf77544c
@ -125,6 +125,11 @@ cnzz:
|
|||||||
enable: true
|
enable: true
|
||||||
url: #
|
url: #
|
||||||
|
|
||||||
|
# Google Analytics
|
||||||
|
google_analytics: ''
|
||||||
|
# 百度统计
|
||||||
|
baidu_analytics: ''
|
||||||
|
|
||||||
# 数学公式
|
# 数学公式
|
||||||
mathjax: true
|
mathjax: true
|
||||||
|
|
||||||
|
@ -86,6 +86,11 @@ cnzz:
|
|||||||
enable: true
|
enable: true
|
||||||
url: https://s9.cnzz.com/z_stat.php?id=1278069914&web_id=1278069914
|
url: https://s9.cnzz.com/z_stat.php?id=1278069914&web_id=1278069914
|
||||||
|
|
||||||
|
# Google Analytics
|
||||||
|
google_analytics: ''
|
||||||
|
# 百度统计
|
||||||
|
baidu_analytics: ''
|
||||||
|
|
||||||
# 数学公式
|
# 数学公式
|
||||||
mathjax: true
|
mathjax: true
|
||||||
|
|
||||||
|
11
layout/_partial/baidu-analytics.ejs
Normal file
11
layout/_partial/baidu-analytics.ejs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<% if (theme.baidu_analytics){ %>
|
||||||
|
<script>
|
||||||
|
var _hmt = _hmt || [];
|
||||||
|
(function() {
|
||||||
|
var hm = document.createElement("script");
|
||||||
|
hm.src = "https://hm.baidu.com/hm.js?<%= theme.baidu_analytics %>";
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(hm, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
<% } %>
|
14
layout/_partial/google-analytics.ejs
Normal file
14
layout/_partial/google-analytics.ejs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<% if (theme.google_analytics){ %>
|
||||||
|
<%# "Google Analytics" %>
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', '<%= theme.google_analytics %>', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<%# "End Google Analytics" %>
|
||||||
|
<% } %>
|
@ -1,16 +1,14 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
|
||||||
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<% var title = page.title; if (is_archive()) { title = __('archive_a'); if
|
<% var title = page.title; if (is_archive()) { title = __('archive_a'); if
|
||||||
(is_month()) { title += ': ' + page.year + '/' + page.month; } else if
|
(is_month()) { title += ': ' + page.year + '/' + page.month; } else if
|
||||||
(is_year()) { title += ': ' + page.year; } } else if (is_category()) { title
|
(is_year()) { title += ': ' + page.year; } } else if (is_category()) { title
|
||||||
= __('categories.ejs') + ': ' + page.categories; } else if (is_tag()) {
|
= __('categories.ejs') + ': ' + page.categories; } else if (is_tag()) {
|
||||||
title = __('tag') + ': ' + page.tag; } %> <% if (page.keywords){ %>
|
title = __('tag') + ': ' + page.tag; } %> <% if (page.keywords){ %>
|
||||||
<meta
|
<meta name="keywords" content="<%= page.keywords %>,<%= config.keywords %>" />
|
||||||
name="keywords"
|
|
||||||
content="<%= page.keywords %>,<%= config.keywords %>"
|
|
||||||
/>
|
|
||||||
<% } else if (config.keywords){ %>
|
<% } else if (config.keywords){ %>
|
||||||
<meta name="keywords" content="<%= config.keywords %>" />
|
<meta name="keywords" content="<%= config.keywords %>" />
|
||||||
<% } %> <% if (page.description){ %>
|
<% } %> <% if (page.description){ %>
|
||||||
@ -18,10 +16,7 @@
|
|||||||
<% } else if (config.description){ %>
|
<% } else if (config.description){ %>
|
||||||
<meta name="description" content="<%= config.description %>" />
|
<meta name="description" content="<%= config.description %>" />
|
||||||
<% } %>
|
<% } %>
|
||||||
<meta
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||||
name="viewport"
|
|
||||||
content="width=device-width, initial-scale=1, maximum-scale=1"
|
|
||||||
/>
|
|
||||||
<title>
|
<title>
|
||||||
<% if (title){ %><%= title %> | <% } %> <%= config.title %>
|
<% if (title){ %><%= title %> | <% } %> <%= config.title %>
|
||||||
</title>
|
</title>
|
||||||
@ -30,5 +25,9 @@
|
|||||||
<% } %>
|
<% } %>
|
||||||
<%- css('css/style') %> <% if (theme.fancybox){ %> <%-
|
<%- css('css/style') %> <% if (theme.fancybox){ %> <%-
|
||||||
css('fancybox/jquery.fancybox.min') %> <% } %> <%- js('/js/pace.min.js') %>
|
css('fancybox/jquery.fancybox.min') %> <% } %> <%- js('/js/pace.min.js') %>
|
||||||
</head>
|
|
||||||
|
<%- partial('google-analytics') %>
|
||||||
|
<%- partial('baidu-analytics') %>
|
||||||
|
</head>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue
Block a user