Skip to content

Commit 4c7195c

Browse files
committed
Add sponsors and push history state when search is updated in search page
1 parent fa2278e commit 4c7195c

File tree

3 files changed

+27
-18
lines changed

3 files changed

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