Skip to content

Commit 09a349e

Browse files
committed
Add sponsors and push history state when search is updated in search page
1 parent 6ddf3fb commit 09a349e

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

src/v2/search/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
---
2+
title: Search Vue.js
3+
type: search
24
search: true
35
---

themes/vue/layout/partials/sidebar.ejs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,27 @@
55
</ul>
66
<div class="list">
77
<%- partial('partials/sponsors_sidebar') %>
8-
<h2>
9-
<% titles = {
10-
api: 'API',
11-
examples: 'Examples',
12-
guide: 'Guide',
13-
cookbook: 'Cookbook<sup class="beta">beta</sup>',
14-
'style-guide': 'Style Guide<sup class="beta">beta</sup>'
15-
} %>
16-
<%- titles[type] %>
17-
<% if (['cookbook', 'style-guide'].indexOf(type) === -1) { %>
18-
<select class="version-select">
19-
<option value="SELF" selected>2.x</option>
20-
<option value="v1">1.0</option>
21-
<option value="012">0.12</option>
22-
<option value="011">0.11</option>
23-
</select>
24-
<% } %>
25-
</h2>
26-
<%- partial('partials/toc', { type: type }) %>
8+
<% if (type !== 'search') { %>
9+
<h2>
10+
<% titles = {
11+
api: 'API',
12+
examples: 'Examples',
13+
guide: 'Guide',
14+
cookbook: 'Cookbook<sup class="beta">beta</sup>',
15+
'style-guide': 'Style Guide<sup class="beta">beta</sup>'
16+
} %>
17+
<%- titles[type] %>
18+
<% if (['cookbook', 'style-guide'].indexOf(type) === -1) { %>
19+
<select class="version-select">
20+
<option value="SELF" selected>2.x</option>
21+
<option value="v1">1.0</option>
22+
<option value="012">0.12</option>
23+
<option value="011">0.11</option>
24+
</select>
25+
<% } %>
26+
</h2>
27+
<%- partial('partials/toc', { type: type }) %>
28+
<% } %>
2729
</div>
2830
</div>
2931
</div>

themes/vue/layout/search-page.ejs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ var searchPage = new Vue({
9191
watch: {
9292
search() {
9393
this.updateSearch()
94+
window.history.pushState(
95+
{},
96+
'Vue.js Search',
97+
window.location.origin + window.location.pathname + '?q=' + encodeURIComponent(this.search)
98+
)
9499
}
95100
},
96101
created() {

0 commit comments

Comments
 (0)