-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
head.swig
158 lines (127 loc) · 5.63 KB
/
head.swig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
<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"/>
<meta name="theme-color" content="{{ theme.android_chrome_color }}">
{% if theme.pace %}
{% set pace_css_uri = url_for(theme.vendors._internal + '/pace/'+ theme.pace_theme +'.min.css?v=1.0.2') %}
{% set pace_js_uri = url_for(theme.vendors._internal + '/pace/pace.min.js?v=1.0.2') %}
{% if theme.vendors.pace %}
{% set pace_js_uri = theme.vendors.pace %}
{% endif %}
{% if theme.vendors.pace_css %}
{% set pace_css_uri = theme.vendors.pace_css %}
{% endif %}
<script src="{{ pace_js_uri }}"></script>
<link href="{{ pace_css_uri }}" rel="stylesheet">
{% endif %}
{% if theme.han %}
{% set Han_uri = url_for(theme.vendors._internal + '/Han/dist/han.min.css?v=3.3') %}
{% if theme.vendors.Han %}
{% set Han_uri = theme.vendors.Han %}
{% endif %}
<link rel="stylesheet" media="all" href="{{ Han_uri }}">
{% endif %}
{# #238, Disable Baidu tranformation #}
<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
{% if theme.google_site_verification %}
<meta name="google-site-verification" content="{{ theme.google_site_verification }}" />
{% endif %}
{% if theme.bing_site_verification %}
<meta name="msvalidate.01" content="{{ theme.bing_site_verification }}" />
{% endif %}
{% if theme.yandex_site_verification %}
<meta name="yandex-verification" content="{{ theme.yandex_site_verification }}" />
{% endif %}
{% if theme.baidu_site_verification %}
<meta name="baidu-site-verification" content="{{ theme.baidu_site_verification }}" />
{% endif %}
{% if theme.qihu_site_verification %}
<meta name="360-site-verification" content="{{ theme.qihu_site_verification }}" />
{% endif %}
{% if theme.fancybox %}
{% set fancybox_css_uri = url_for(theme.vendors._internal + '/fancybox/source/jquery.fancybox.css?v=2.1.5') %}
{% if theme.vendors.fancybox_css %}
{% set fancybox_css_uri = theme.vendors.fancybox_css %}
{% endif %}
<link href="{{ fancybox_css_uri }}" rel="stylesheet" type="text/css" />
{% endif %}
{% include "./head/external-fonts.swig" %}
{% set font_awesome_uri = url_for(theme.vendors._internal + '/font-awesome/css/font-awesome.min.css?v=4.6.2') %}
{% if theme.vendors.fontawesome %}
{% set font_awesome_uri = theme.vendors.fontawesome %}
{% endif %}
<link href="{{ font_awesome_uri }}" rel="stylesheet" type="text/css" />
<link href="{{ url_for(theme.css) }}/main.css?v={{ theme.version }}" rel="stylesheet" type="text/css" />
{% if theme.favicon.apple_touch_icon %}
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for(theme.favicon.apple_touch_icon) }}?v={{ theme.version }}">
{% endif %}
{% if theme.favicon.medium %}
<link rel="icon" type="image/png" sizes="32x32" href="{{ url_for(theme.favicon.medium) }}?v={{ theme.version }}">
{% endif %}
{% if theme.favicon.small %}
<link rel="icon" type="image/png" sizes="16x16" href="{{ url_for(theme.favicon.small) }}?v={{ theme.version }}">
{% endif %}
{% if theme.favicon.safari_pinned_tab %}
<link rel="mask-icon" href="{{ url_for(theme.favicon.safari_pinned_tab) }}?v={{ theme.version }}" color="{{ theme.android_chrome_color }}">
{% endif %}
{% if theme.favicon.android_manifest %}
<link rel="manifest" href="{{ url_for(theme.favicon.android_manifest) }}">
{% endif %}
{% if theme.favicon.ms_browserconfig %}
<meta name="msapplication-config" content="{{ url_for(theme.favicon.ms_browserconfig) }}" />
{% endif %}
{% if page.keywords %}
<meta name="keywords" content="{{ page.keywords }}" />
{% elif page.tags and page.tags.length %}
<meta name="keywords" content="{% for tag in page.tags %}{{ tag.name }},{% endfor %}" />
{% elif theme.keywords %}
<meta name="keywords" content="{{ theme.keywords }}" />
{% endif %}
{% if theme.rss === '' and config.feed and config.feed.path %}
{% set theme.rss = config.feed.path %}
{% endif %}
{% if theme.rss %}
<link rel="alternate" href="{{ url_for(theme.rss) }}" title="{{ config.title }}" type="application/atom+xml" />
{% endif %}
{% if theme.facebook_sdk.enable and theme.facebook_sdk.webmaster %}
<meta property="fb:admins" content="{{ theme.facebook_sdk.fb_admin }}" />
<meta property="fb:app_id" content="{{ theme.facebook_sdk.app_id }}" />
{% endif %}
{{
open_graph({
twitter_id: theme.twitter,
google_plus: theme.google_plus,
fb_admins: theme.fb_admins,
fb_app_id: theme.fb_app_id
})
}}
{# Export some HEXO Configurations to Front-End #}
<script type="text/javascript" id="hexo.configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '{{ theme.root }}',
scheme: '{{ theme.scheme }}',
version: '{{ theme.version }}',
sidebar: {{ theme.sidebar | json_encode }},
fancybox: {{ theme.fancybox }},
tabs: {{ theme.tabs.enable }},
motion: {{ theme.motion | json_encode }},
duoshuo: {
userId: '{{ theme.duoshuo_info.user_id | default() }}',
author: '{{ theme.duoshuo_info.admin_nickname | default(__('author'))}}'
},
algolia: {
applicationID: '{{ theme.algolia.applicationID }}',
apiKey: '{{ theme.algolia.apiKey }}',
indexName: '{{ theme.algolia.indexName }}',
hits: {{ theme.algolia_search.hits | json_encode }},
labels: {{ theme.algolia_search.labels | json_encode }}
}
};
</script>
{# Canonical, good for google search engine (SEO) : https://support.google.com/webmasters/answer/139066 #}
{% if theme.canonical %}
<link rel="canonical" href="{{ config.url }}/{{ page.canonical_path.replace('index.html', '') }}"/>
{% endif %}
{% include 'head/custom-head.swig' %}