Skip to content

Commit d2a1e51

Browse files
committed
Sync themes/vue/layout.
* Updated all resource path format. * Added more kinds of icons and logos. * Added offline informations. * Moved the ga code from body to head. * Added /js/css.escape.js * Splited toc from sidebar.ejs. * Added French link. * Removed community_dropdown. * Moved /about/ link to the end of main_menu.
1 parent 0a497b9 commit d2a1e51

File tree

11 files changed

+116
-92
lines changed

11 files changed

+116
-92
lines changed

themes/vue/layout/index.ejs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
<div id="hero">
88
<div class="inner">
99
<div class="left">
10-
<img class="hero-logo" src="/images/logo.png">
10+
<img class="hero-logo" src="<%- url_for("/images/logo.png") %>">
1111
</div><div class="right">
1212
<h2 class="vue">Vue.js</h2>
1313
<h1>
1414
渐进式<br>JavaScript 框架
1515
</h1>
1616
<p>
17-
<a class="button" href="/v2/guide/">起步</a>
17+
<a class="button" href="<%- url_for("/v2/guide/") %>">起步</a>
1818
<a class="button white" href="https://github.com/vuejs/vue" target="_blank">GITHUB</a>
1919
</p>
2020
</div>
@@ -23,8 +23,6 @@
2323

2424
<div id="highlights">
2525
<div class="inner">
26-
27-
2826
<div class="point">
2927
<h2>易用</h2>
3028
<p>已经会了HTML,CSS,JavaScript?即刻阅读指南开始构建应用!</p>
@@ -33,7 +31,7 @@
3331
<div class="point">
3432
<h2>灵活</h2>
3533
<p>简单小巧的核心,渐进式技术栈,足以应付任何规模的应用。</p>
36-
</div>
34+
</div>
3735

3836
<div class="point">
3937
<h2>性能</h2>
@@ -51,13 +49,13 @@
5149
<h3>赞助者</h3>
5250
<%- partial('partials/sponsors') %>
5351
<br>
54-
<a class="become-sponsor button white" href="/support-vuejs/">成为赞助者</a>
52+
<a class="become-sponsor button white" href="<%- url_for("/support-vuejs/") %>">成为赞助者</a>
5553
</div>
5654
</div>
5755

5856
<div id="footer">
59-
遵循 <a href="https://opensource.org/licenses/MIT" href="_blank">MIT 开源协议</a><br>
60-
Copyright &copy; 2014-<%- new Date().getFullYear() %> Evan You
57+
<p>遵循 <a href="https://opensource.org/licenses/MIT" target="_blank">MIT 开源协议</a><br>
58+
Copyright &copy; 2014-<%- new Date().getFullYear() %> Evan You</p>
6159
</div>
6260

6361
<script>

themes/vue/layout/layout.ejs

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,63 @@
22
<!DOCTYPE html>
33
<html lang="zh-CN">
44
<head>
5-
<title><%- page.title ? page.title + ' - ' : '' %>Vue.js</title>
5+
<title><%- page.title ? page.title + ' ' : '' %>Vue.js</title>
66
<meta charset="utf-8">
77
<meta name="description" content="<%- theme.site_description %>">
88
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
9+
910
<meta property="og:type" content="article">
10-
<meta property="og:title" content="<%- page.title ? page.title + ' - ' : '' %>vue.js">
11+
<meta property="og:title" content="<%- page.title ? page.title + ' ' : '' %>Vue.js">
1112
<meta property="og:description" content="<%- theme.site_description %>">
12-
<meta property="og:image" content="https://<%- theme.root_domain %>/images/logo.png">
13+
<meta property="og:image" content="https://<%- theme.root_domain %>/<%- url_for("/images/logo.png") %>">
1314

1415
<meta name="twitter:card" content="summary">
15-
<meta name="twitter:title" content="<%- page.title ? page.title + ' - ' : '' %>vue.js">
16+
<meta name="twitter:title" content="<%- page.title ? page.title + ' ' : '' %>Vue.js">
1617
<meta name="twitter:description" content="<%- theme.site_description %>">
1718
<meta name="twitter:image" content="https://<%- theme.root_domain %>/images/logo.png">
1819

19-
<link rel="icon" href="/images/logo.png" type="image/x-icon">
20+
<link rel="apple-touch-icon" sizes="57x57" href="<%- url_for("/images/icons/apple-icon-57x57.png") %>">
21+
<link rel="apple-touch-icon" sizes="60x60" href="<%- url_for("/images/icons/apple-icon-60x60.png") %>">
22+
<link rel="apple-touch-icon" sizes="72x72" href="<%- url_for("/images/icons/apple-icon-72x72.png") %>">
23+
<link rel="apple-touch-icon" sizes="76x76" href="<%- url_for("/images/icons/apple-icon-76x76.png") %>">
24+
<link rel="apple-touch-icon" sizes="114x114" href="<%- url_for("/images/icons/apple-icon-114x114.png") %>">
25+
<link rel="apple-touch-icon" sizes="120x120" href="<%- url_for("/images/icons/apple-icon-120x120.png") %>">
26+
<link rel="apple-touch-icon" sizes="144x144" href="<%- url_for("/images/icons/apple-icon-144x144.png") %>">
27+
<link rel="apple-touch-icon" sizes="152x152" href="<%- url_for("/images/icons/apple-icon-152x152.png") %>">
28+
<link rel="apple-touch-icon" sizes="180x180" href="<%- url_for("/images/icons/apple-icon-180x180.png") %>">
29+
<link rel="icon" type="image/png" sizes="192x192" href="<%- url_for("/images/icons/android-icon-192x192.png") %>">
30+
<link rel="icon" type="image/png" sizes="32x32" href="<%- url_for("/images/icons/favicon-32x32.png") %>">
31+
<link rel="icon" type="image/png" sizes="96x96" href="<%- url_for("/images/icons/favicon-96x96.png") %>">
32+
<link rel="icon" type="image/png" sizes="16x16" href="<%- url_for("/images/icons/favicon-16x16.png") %>">
33+
<meta name="msapplication-TileImage" content="/images/icons/ms-icon-144x144.png">
34+
<link rel="icon" href="<%- url_for("/images/logo.png") %>" type="image/png">
35+
36+
<meta name="msapplication-TileColor" content="#4fc08d">
37+
<meta name="theme-color" content="#4fc08d">
38+
39+
<meta name="msapplication-config" content="browserconfig.xml">
40+
<link rel="manifest" href="/manifest.json">
2041

2142
<!-- <link href='//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600|Roboto Mono' rel='stylesheet' type='text/css'> -->
43+
<!-- <link href='//fonts.googleapis.com/css?family=Dosis:500&text=Vue.js' rel='stylesheet' type='text/css'> -->
2244

2345
<!-- main page styles -->
2446
<%- css(isIndex ? 'css/index' : 'css/page') %>
2547

2648
<!-- this needs to be loaded before guide's inline scripts -->
27-
<script src="/js/vue.js"></script>
49+
<script src="<%- url_for("/js/vue.js") %>"></script>
2850
<script>window.PAGE_TYPE = "<%- page.type %>"</script>
51+
52+
<!-- ga -->
53+
<script>
54+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
55+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
56+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
57+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
58+
59+
ga('create', '<%- theme.google_analytics %>', '<%- theme.root_domain %>');
60+
ga('send', 'pageview');
61+
</script>
2962
</head>
3063
<body class="<%- isIndex ? '' : 'docs' -%>">
3164
<div id="mobile-bar" <%- isIndex ? 'class="top"' : '' %>>
@@ -41,24 +74,14 @@
4174
<%- body %>
4275
<% } %>
4376
</div>
44-
<script src="/js/smooth-scroll.min.js"></script>
77+
<script src="<%- url_for("/js/smooth-scroll.min.js") %>"></script>
4578
<% } else { %>
4679
<%- body %>
4780
<% } %>
4881

4982
<!-- main custom script for sidebars, version selects etc. -->
50-
<script src="/js/common.js"></script>
51-
52-
<!-- ga -->
53-
<script>
54-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
55-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
56-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
57-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
58-
59-
ga('create', '<%- theme.google_analytics %>', '<%- theme.root_domain %>');
60-
ga('send', 'pageview');
61-
</script>
83+
<script src="<%- url_for("/js/css.escape.js") %>"></script>
84+
<script src="<%- url_for("/js/common.js") %>"></script>
6285

6386
<!-- search -->
6487
<link href="//cdn.jsdelivr.net/docsearch.js/1/docsearch.min.css" rel='stylesheet' type='text/css'>
@@ -67,7 +90,8 @@
6790
<script>
6891
[
6992
'#search-query-nav',
70-
'#search-query-sidebar'
93+
'#search-query-sidebar',
94+
'#search-query-menu'
7195
].forEach(function (selector) {
7296
if (!document.querySelector(selector)) return
7397
// search index defaults to v2

themes/vue/layout/page.ejs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% if (page.type) { %>
2-
<%- partial('partials/sidebar', { type: page.type, index: page.index }) %>
2+
<%- partial('partials/sidebar', { type: page.type === 'menu' ? 'guide' : page.type, index: page.index }) %>
33
<% } else { %>
44
<div class="sidebar">
55
<ul class="main-menu">
@@ -8,6 +8,16 @@
88
</div>
99
<% } %>
1010
<div class="content <%- page.type ? page.type + ' with-sidebar' : '' %> <%- page.type === 'guide' ? page.path.replace(/.+\//, '').replace('.html', '') + '-guide' : '' %>">
11+
<% if (page.type) { %>
12+
<% if (page.type === 'menu') { %>
13+
<form id="search-form">
14+
<input type="text" id="search-query-menu" class="search-query st-default-search-input">
15+
</form>
16+
<%- partial('partials/toc', { type: 'guide' }) %>
17+
<% } else { %>
18+
<%- partial('partials/ad') %>
19+
<% } %>
20+
<% } %>
1121
<% if (page.title.trim()) { %>
1222
<h1><%- page.title %><%- page.type === 'examples' ? ' Example' : '' %></h1>
1323
<% } %>

themes/vue/layout/partials/community_dropdown.ejs

Lines changed: 0 additions & 10 deletions
This file was deleted.

themes/vue/layout/partials/ga.ejs

Whitespace-only changes.

themes/vue/layout/partials/header.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div id="header">
2-
<a id="logo" href="/">
3-
<img src="/images/logo.png">
2+
<a id="logo" href="<%- url_for("/") %>">
3+
<img src="<%- url_for("/images/logo.png") %>">
44
<span>Vue.js</span>
55
</a>
66
<ul id="nav">
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<li class="nav-dropdown-container language">
22
<a class="nav-link">多语言</a><span class="arrow"></span>
33
<ul class="nav-dropdown">
4-
<li><a href="https://cn.vuejs.org/" class="nav-link" target="_blank">中文</a></li>
54
<li><a href="https://vuejs.org/" class="nav-link" target="_blank">English</a></li>
65
<li><a href="https://jp.vuejs.org/" class="nav-link" target="_blank">日本語</a></li>
76
<li><a href="https://ru.vuejs.org/" class="nav-link" target="_blank">Русский</a></li>
87
<li><a href="https://kr.vuejs.org/" class="nav-link" target="_blank">한국어</a></li>
98
<li><a href="https://br.vuejs.org/" class="nav-link" target="_blank">Português</a></li>
9+
<li><a href="https://fr.vuejs.org/" class="nav-link" target="_blank">Français</a></li>
1010
</ul>
1111
</li>

themes/vue/layout/partials/main_menu.ejs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
<input type="text" id="search-query-<%- context %>" class="search-query st-default-search-input">
44
</form>
55
</li>
6-
<li><a href="/v2/guide/" class="nav-link<%- page.path.match(/guide/) ? ' current' : '' %>">教程</a></li>
7-
<li><a href="/v2/api/" class="nav-link<%- page.path.match(/api/) ? ' current' : '' %>">API</a></li>
8-
<li><a href="/v2/examples/" class="nav-link<%- page.path.match(/examples/) ? ' current' : '' %>">示例</a></li>
9-
<li><a href="/about/" class="nav-link<%- page.path.match(/about/) ? ' current' : '' %>">参与贡献</a></li>
10-
<%- partial('partials/community_dropdown') %>
6+
<li><a href="<%- url_for("/v2/guide/") %>" class="nav-link<%- page.path.match(/guide/) ? ' current' : '' %>">教程</a></li>
7+
<li><a href="<%- url_for("/v2/api/") %>" class="nav-link<%- page.path.match(/api/) ? ' current' : '' %>">API</a></li>
8+
<li><a href="<%- url_for("/v2/examples/") %>" class="nav-link<%- page.path.match(/examples/) ? ' current' : '' %>">示例</a></li>
119
<%- partial('partials/ecosystem_dropdown') %>
12-
<%- partial('partials/language_dropdown') %>
10+
<%- partial('partials/language_dropdown') %>
11+
<li>
12+
<a href="https://vue.threadless.com" target="_blank" class="nav-link shop">Shop</a>
13+
</li>
14+
<li><a href="<%- url_for("/about/") %>" class="nav-link<%- page.path.match(/about/) ? ' current' : '' %>">参与贡献</a></li>

themes/vue/layout/partials/sidebar.ejs

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,56 +9,18 @@
99
<img src="/images/upyun-main-4.jpg">
1010
</a>
1111
</div>
12-
<a class="become-backer" href="/support-vuejs">
13-
成为赞助者
12+
<a class="become-backer" href="<%- url_for("/support-vuejs") %>">
13+
Become a Sponsor
1414
</a>
1515
<h2>
1616
<% titles = {api: 'API', examples: '示例', guide: '教程'} %>
1717
<% if (type !== 'cookbook') { %>
1818
<select class="version-select">
19-
<option value="SELF" selected>2.0</option>
19+
<option value="SELF" selected>2.x</option>
2020
<option value="v1">1.0</option>
2121
</select>
2222
<% } %>
2323
</h2>
24-
<ul class="menu-root">
25-
<% type !== 'api' && type !== 'router' && site.pages.find({type: type}).sort('order').each(function (p) { %>
26-
<% var fileName = p.path.replace(/^.+?\/([\w-]+)\.html/, '$1') %>
27-
28-
<% if (type === 'guide') { %>
29-
<% if (fileName === 'installation') { %>
30-
<li><h3>基础</h3></li>
31-
<% } %>
32-
<% if (fileName === 'reactivity') { %>
33-
<li><h3>进阶</h3></li>
34-
<% } %>
35-
<% if (fileName === 'migration') { %>
36-
<li><h3>迁移</h3></li>
37-
<% } %>
38-
<% if (fileName === 'comparison') { %>
39-
<li><h3>更多</h3></li>
40-
<% } %>
41-
<% } %>
42-
<% if (type === 'cookbook') { %>
43-
<% if (p.order === 1.1) { %>
44-
<li><h3>Vue Instance</h3></li>
45-
<% } %>
46-
<!-- Move cookbook sections here once they have -->
47-
<!-- at least one recipe -->
48-
<% } %>
49-
<li>
50-
<a href="/<%- p.path %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
51-
</li>
52-
<% }) %>
53-
<% if (type === 'cookbook') { %>
54-
<li><h3>Components</h3></li>
55-
<li><h4>Form Inputs</h4></li>
56-
<li><h4>3rd-Party Integrations</h4></li>
57-
<li><h3>Transitions</h3></li>
58-
<li><h3>Directives</h3></li>
59-
<li><h3>Vue Router</h3></li>
60-
<li><h3>Vuex</h3></li>
61-
<% } %>
62-
</ul>
24+
<%- partial('partials/toc', { type: type }) %>
6325
</div>
6426
</div>

themes/vue/layout/partials/toc.ejs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<ul class="menu-root">
2+
<% type !== 'api' && site.pages.find({type: type}).sort('order').each(function (p) { %>
3+
<% var fileName = p.path.replace(/^.+?\/([\w-]+)\.html/, '$1') %>
4+
<% if (type === 'guide') { %>
5+
<% if (fileName === 'installation') { %>
6+
<li><h3>基础</h3></li>
7+
<% } %>
8+
<% if (fileName === 'reactivity') { %>
9+
<li><h3>进阶</h3></li>
10+
<% } %>
11+
<% if (fileName === 'migration') { %>
12+
<li><h3>迁移</h3></li>
13+
<% } %>
14+
<% if (fileName === 'comparison') { %>
15+
<li><h3>更多</h3></li>
16+
<% } %>
17+
<% } %>
18+
<% if (type === 'cookbook') { %>
19+
<% if (p.order === 1.1) { %>
20+
<li><h3>Vue Instance</h3></li>
21+
<% } %>
22+
<!-- Move cookbook sections here once they have -->
23+
<!-- at least one recipe -->
24+
<% } %>
25+
<li>
26+
<a href="<%- url_for(p.path) %>" class="sidebar-link<%- page.title === p.title ? ' current' : '' %><%- p.is_new ? ' new' : '' %>"><%- p.title %></a>
27+
</li>
28+
<% }) %>
29+
<% if (type === 'cookbook') { %>
30+
<li><h3>Components</h3></li>
31+
<li><h4>Form Inputs</h4></li>
32+
<li><h4>3rd-Party Integrations</h4></li>
33+
<li><h3>Transitions</h3></li>
34+
<li><h3>Directives</h3></li>
35+
<li><h3>Vue Router</h3></li>
36+
<li><h3>Vuex</h3></li>
37+
<% } %>
38+
</ul>

themes/vue/layout/post.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<div class="list">
66
<h2>
77
Recent Posts
8-
<a href="/atom.xml" target="_blank" style="vertical-align: middle; margin-left: 5px">
9-
<img src="/images/feed.png" style="width:15px;height:15px">
8+
<a href="<%- url_for("/atom.xml") %>" target="_blank" style="vertical-align: middle; margin-left: 5px">
9+
<img src="<%- url_for("/images/feed.png") %>" style="width:15px;height:15px">
1010
</a>
1111
</h2>
1212
<ul style="padding:0">

0 commit comments

Comments
 (0)