-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
169 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,12 @@ echo "theme = 'hera'" >> hugo.toml | |
|
||
## 更新日志 | ||
|
||
### 0.0.8 | ||
|
||
- 增加搜索 | ||
- 增加分页链接 | ||
- 增加卡片分类 | ||
|
||
### 0.0.7 | ||
|
||
- 修复评论提交错误 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{{ define "main" }} | ||
<div class="articleContainer"> | ||
<header class="term--header"> | ||
<h1 class="term--title">{{.Title}}</h1> | ||
{{ if .Params.description }} | ||
<div class="term--description">{{ .Params.description }}</div> | ||
{{ end }} | ||
</header> | ||
{{- $pages := union .RegularPages .Sections }} | ||
{{- $paginator := .Paginate $pages }} | ||
<div class="post--cards"> | ||
{{- range $index, $page := $paginator.Pages }} | ||
<article class="post--card"> | ||
{{ if .Content }} | ||
{{ $urls := findRE "<img src=\"[^\"|\\\"]*\"" .Content }} {{ if $urls }} {{ $url :=index ($urls) 0 }} {{ | ||
$url :=(strings.TrimPrefix "<img src=\"" $url) }} | ||
{{ $url := strings.TrimRight " \"" $url }} <a href="{{ .Permalink }}" class="cover--link"><img src="{{ $url }}" | ||
class="cover" /></a> | ||
{{ else }} | ||
<a href="{{ .Permalink }}" class="cover--link"><img src="{{ .Site.Params.defaultCover }}" | ||
class="cover" /></a> | ||
{{ end }} | ||
{{ end }} | ||
<div class="card--content"> | ||
<h2 class="post--title"> | ||
<a href="{{ .Permalink }}"> | ||
{{ .Title }} | ||
</a> | ||
</h2> | ||
<div class="description">{{ .Summary | plainify | truncate 60 }}</div> | ||
<div class="meta"> | ||
<svg class="icon" viewBox="0 0 1024 1024" width="16" height="16"> | ||
<path | ||
d="M512 97.52381c228.912762 0 414.47619 185.563429 414.47619 414.47619s-185.563429 414.47619-414.47619 414.47619S97.52381 740.912762 97.52381 512 283.087238 97.52381 512 97.52381z m0 73.142857C323.486476 170.666667 170.666667 323.486476 170.666667 512s152.81981 341.333333 341.333333 341.333333 341.333333-152.81981 341.333333-341.333333S700.513524 170.666667 512 170.666667z m36.571429 89.697523v229.86362h160.865523v73.142857H512a36.571429 36.571429 0 0 1-36.571429-36.571429V260.388571h73.142858z"> | ||
</path> | ||
</svg> | ||
<time datetime='{{.Date.Format "2006-01-02 15:04:01" }}' class="humane--time">{{ .Date | time.Format | ||
":date_long" | ||
}}</time> | ||
</div> | ||
</div> | ||
</article> | ||
{{ end }} | ||
</div> | ||
{{ $paginator := .Paginate (where .Pages "Type" "post") }} | ||
<nav class="navigation "> | ||
<div class="nav-links"> | ||
{{ range $paginator.Pagers }} | ||
<a class="page-numbers{{ if eq . $paginator }} current{{ end }}" href="{{ .URL }}">{{ .PageNumber }}</a> | ||
{{ end }} | ||
</div> | ||
</nav> | ||
</div> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
{{ define "main" }} | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/themes/reset-min.css" | ||
integrity="sha256-2AeJLzExpZvqLUxMfcs+4DWcMwNfpnjUeAAvEtPr0wU=" crossorigin="anonymous"> | ||
<div class="articleContainer"> | ||
<div class="site--main"> | ||
<div id="hits" class="block--list"></div> | ||
<div id="pagination"></div> | ||
</div> | ||
</div> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/algoliasearch-lite.umd.js" | ||
integrity="sha256-DABVk+hYj0mdUzo+7ViJC6cwLahQIejFvC+my2M/wfM=" crossorigin="anonymous"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/instantsearch.production.min.js" | ||
integrity="sha256-9242vN47QUX50UG5Gf5XDO1YREWCEJRyXHofh5fsl24=" crossorigin="anonymous"></script> | ||
<script> | ||
const searchClient = algoliasearch('{{ .Site.Params.searchAPPID }}', '{{ .Site.Params.searchKey }}'); | ||
|
||
const search = instantsearch({ | ||
indexName: '{{ .Site.Params.indexName }}', | ||
searchClient, | ||
insights: false | ||
}); | ||
|
||
search.addWidgets([ | ||
instantsearch.widgets.searchBox({ | ||
container: '#searchbox', | ||
showReset: false, | ||
placeholder: 'Search for stories', | ||
cssClasses: { | ||
form: ['search-form'], | ||
input: ['search-field'] | ||
}, | ||
templates: { | ||
submit: `<input type="submit" class="search-submit" value="Search">` | ||
} | ||
}), | ||
|
||
instantsearch.widgets.hits({ | ||
container: '#hits', | ||
templates: { | ||
item(hit, { html, components, sendEvent }) { | ||
const time = new Date(hit.date); | ||
const date = time.toLocaleDateString('en-US', { | ||
year: 'numeric', | ||
month: 'long', | ||
day: 'numeric', | ||
}); | ||
const lngString = '{{ .Site.Language }}'; | ||
const uri = hit.uri.replace("/" + lngString + "/", "/"); | ||
const cover = hit.cover ? html`<img src="${hit.cover}" class="cover" itemprop="image" />` : ''; | ||
return html`<article class="block--item" itemtype="http://schema.org/Article" itemscope="itemscope"> | ||
<h2 class="block--title"> | ||
<a href="${uri}">${components.Highlight({ attribute: 'title', hit })}</a> | ||
</h2> | ||
<div class="block--addon"> | ||
<div class="meta"> | ||
<div class="block--snippet"> | ||
<div class="summary">${hit.description}</div> | ||
<div class="block--meta"> | ||
${date} | ||
</div> | ||
</div> | ||
</div></div> | ||
<a href="${uri}" class="block--cover"> ${cover}</a> | ||
</article> | ||
`; | ||
}, | ||
}, | ||
}) | ||
]); | ||
|
||
search.start(); | ||
const queryString = window.location.search; | ||
const params = new URLSearchParams(queryString); | ||
search.helper.setQuery(params.get("s")).search(); | ||
</script> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.