feat: Google Analytics,百度统计
This commit is contained in:
parent
08c9fb777e
commit
d7cf77544c
@ -125,6 +125,11 @@ cnzz:
|
||||
enable: true
|
||||
url: #
|
||||
|
||||
# Google Analytics
|
||||
google_analytics: ''
|
||||
# 百度统计
|
||||
baidu_analytics: ''
|
||||
|
||||
# 数学公式
|
||||
mathjax: true
|
||||
|
||||
|
@ -86,6 +86,11 @@ cnzz:
|
||||
enable: true
|
||||
url: https://s9.cnzz.com/z_stat.php?id=1278069914&web_id=1278069914
|
||||
|
||||
# Google Analytics
|
||||
google_analytics: ''
|
||||
# 百度统计
|
||||
baidu_analytics: ''
|
||||
|
||||
# 数学公式
|
||||
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,34 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<% var title = page.title; if (is_archive()) { title = __('archive_a'); if
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<% var title = page.title; if (is_archive()) { title = __('archive_a'); if
|
||||
(is_month()) { title += ': ' + page.year + '/' + page.month; } else if
|
||||
(is_year()) { title += ': ' + page.year; } } else if (is_category()) { title
|
||||
= __('categories.ejs') + ': ' + page.categories; } else if (is_tag()) {
|
||||
title = __('tag') + ': ' + page.tag; } %> <% if (page.keywords){ %>
|
||||
<meta
|
||||
name="keywords"
|
||||
content="<%= page.keywords %>,<%= config.keywords %>"
|
||||
/>
|
||||
<% } else if (config.keywords){ %>
|
||||
<meta name="keywords" content="<%= config.keywords %>" />
|
||||
<% } %> <% if (page.description){ %>
|
||||
<meta name="description" content="<%= page.description %>" />
|
||||
<% } else if (config.description){ %>
|
||||
<meta name="description" content="<%= config.description %>" />
|
||||
<% } %>
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1, maximum-scale=1"
|
||||
/>
|
||||
<title>
|
||||
<% if (title){ %><%= title %> | <% } %> <%= config.title %>
|
||||
</title>
|
||||
<% if (theme.favicon){ %>
|
||||
<link rel="shortcut icon" href="<%- theme.favicon %>" />
|
||||
<% } %>
|
||||
<%- css('css/style') %> <% if (theme.fancybox){ %> <%-
|
||||
<meta name="keywords" content="<%= page.keywords %>,<%= config.keywords %>" />
|
||||
<% } else if (config.keywords){ %>
|
||||
<meta name="keywords" content="<%= config.keywords %>" />
|
||||
<% } %> <% if (page.description){ %>
|
||||
<meta name="description" content="<%= page.description %>" />
|
||||
<% } else if (config.description){ %>
|
||||
<meta name="description" content="<%= config.description %>" />
|
||||
<% } %>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||
<title>
|
||||
<% if (title){ %><%= title %> | <% } %> <%= config.title %>
|
||||
</title>
|
||||
<% if (theme.favicon){ %>
|
||||
<link rel="shortcut icon" href="<%- theme.favicon %>" />
|
||||
<% } %>
|
||||
<%- css('css/style') %> <% if (theme.fancybox){ %> <%-
|
||||
css('fancybox/jquery.fancybox.min') %> <% } %> <%- js('/js/pace.min.js') %>
|
||||
</head>
|
||||
</html>
|
||||
|
||||
<%- partial('google-analytics') %>
|
||||
<%- partial('baidu-analytics') %>
|
||||
</head>
|
||||
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user