搜索优化

This commit is contained in:
结发受长生 2018-06-19 11:56:37 +08:00
parent e9f800303d
commit 0b0053c07e
7 changed files with 14 additions and 15 deletions

View File

@ -1,3 +1,3 @@
<a href="<%- url_for(post.path) %>" class="<%= class_name %>"> <a href="<%- url_for('/archives'+date(post.date, '/YYYY/MM')) %>" class="<%= class_name %>">
<time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><i class="icon-calendar icon"></i><%= date(post.date, date_format) %></time> <time datetime="<%= date_xml(post.date) %>" itemprop="datePublished"><i class="icon-calendar icon"></i><%= date(post.date, date_format) %></time>
</a> </a>

View File

@ -1 +1 @@
<%- js('js/mobile.cfb38e2874478d984279.js') %> <%- js('js/slider.a6b92350b3a9ce92ddd9.js') %> <%- js('js/main.34802c21ea4824f2ae00.js') %> <%- js('js/mobile.cfb38e2874478d984279.js') %> <%- js('js/slider.5ca5d3094d7d23f182cf.js') %> <%- js('js/main.34802c21ea4824f2ae00.js') %>

View File

@ -91,13 +91,13 @@
<i class="icon-calendar icon"></i> <i class="icon-calendar icon"></i>
<span >{{item.date|dateformat}}</span> <span >{{item.date|dateformat}}</span>
</p> </p>
<p class="search-category"> <p class="search-category" v-if="item.categories.length">
<i class="icon-book icon"></i> <i class="icon-book icon" ></i>
<span v-for="category in item.categories" @click="chose(category.name, '$')" >{{'$'+category.name}}</span> <span v-for="category in item.categories" @click="chose(category.name, '$')" >{{category.name}}</span>
</p> </p>
<p class="search-tag"> <p class="search-tag" v-if="item.tags.length">
<i class="icon-price-tags icon"></i> <i class="icon-price-tags icon" ></i>
<span v-for="tag in item.tags" @click="chose(tag.name, '#')" >{{'#'+tag.name}}</span> <span v-for="tag in item.tags" @click="chose(tag.name, '#')" >{{tag.name}}</span>
</p> </p>
</li> </li>
</ul> </ul>
@ -124,5 +124,4 @@
</section> </section>
<%}%> <%}%>
</div> </div>
</div> </div>

View File

@ -3,8 +3,8 @@
"version": "4.0.0", "version": "4.0.0",
"description": "a theme for hexo", "description": "a theme for hexo",
"scripts": { "scripts": {
"dev": "webpack", "dev": "webpack --watch",
"dist": "webpack -p" "build": "webpack -p"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -113,12 +113,12 @@ function handleSearch(val) {
break break
case 'tag' : case 'tag' :
item.isHide = Array.prototype.every.call(item.tags, function(tag){ item.isHide = Array.prototype.every.call(item.tags, function(tag){
return tag.name.toLowerCase().indexOf(val) < 0 return tag.name.toLowerCase() !== val
}) })
break break
case 'category' : case 'category' :
item.isHide = Array.prototype.every.call(item.categories, function(category){ item.isHide = Array.prototype.every.call(item.categories, function(category){
return category.name.toLowerCase().indexOf(val) < 0 return category.name.toLowerCase() !== val
}) })
break break
} }

View File

@ -73,5 +73,5 @@ module.exports = {
dry: false, dry: false,
}) })
], ],
watch: true // watch: true
} }