mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-07 15:22:26 +08:00
46 lines
2.8 KiB
HTML
46 lines
2.8 KiB
HTML
{{define "search"}}
|
||
<div id="content" class="inner">
|
||
<article class="post post-search">
|
||
<h1 class="title">站内搜索</h1>
|
||
<div class="entry-content">
|
||
<div id="search">
|
||
<form action="/search.html">
|
||
<div class="wrapper">
|
||
<input maxlength="80" placeholder="请输入关键字..." id="keyword" name="q" value="{{.Word}}" type="search" required>
|
||
</div>
|
||
<input class="submit" type="submit" value="搜索">
|
||
</form>
|
||
</div>
|
||
<div id="searchResult">
|
||
{{if .Word}}{{with .SearchResult}}{{if gt (.Hits.Hits|len) 0}}
|
||
<div class="info">本次搜索共找到结果 {{.Hits.Total}} 条 (用时 {{.Took}} 秒)</div>
|
||
{{range .Hits.Hits}}
|
||
<div class="item">
|
||
<div class="title"><a href="/post/{{.Source.Slug}}.html">{{if .Highlight.Title}}{{str2html (join .Highlight.Title "")}}{{else}}{{.Source.Title}}{{end}}</a></div>
|
||
<div class="desc">
|
||
<div class="summary"><span class="date">{{dateformat .Source.CreateTime "2006-01-02"}}</span> ... {{str2html (join .Highlight.Content "...")}} ...</div>
|
||
</div>
|
||
</div>
|
||
{{end}}{{else}}
|
||
<div class="no-result">没有找到任何结果,请更换查询词试试~</div>
|
||
<div class="item">
|
||
<div class="title">或者试试 Google 站内搜索:<a target="_blank" href="//www.google.com/#q=site:{{$.Domain}} {{$.Word}}">site:{{$.Domain}} {{$.Word}}</a></div>
|
||
</div>{{end}}{{end}}
|
||
{{else}}
|
||
<div class="hot-words">热搜词:{{range .HotWords}}<a href="?q={{.}}">{{.}}</a>{{end}}</div>
|
||
<div class="intro">
|
||
<p>支持的搜索格式:</p>
|
||
<ol>
|
||
<li>输入关键词全文搜索:<a href="?q=HTTP/2 性能优化">HTTP/2 性能优化</a>;</li>
|
||
<li>指定时间段搜索:<a href="?q=date:2014">date:2014</a>、<a href="?q=date:2015-05">date:2015-05</a>;</li>
|
||
<li>指定标签搜索:<a href="?q=tag:性能优化">tag:性能优化</a>、<a href="?q=tag:HTTPS">tag:HTTPS</a>;</li>
|
||
<li>组合搜索:<a href="?q=type:post date:2015 tag:HTTP 优化">type:post date:2015 tag:HTTP 优化</a>;</li>
|
||
</ol>
|
||
</div>
|
||
{{end}}
|
||
</div>
|
||
</div>
|
||
</article>
|
||
{{if or .Prev .Next}}<nav class="page-navi">{{with .Prev}}<a href="?{{html .}}" class="prev">« 上一页</a>{{end}}{{with .Next}}<a href="?{{html .}}" class="next">下一页 »</a>{{end}}</nav>{{end}}
|
||
</div>{{end}}
|