diff options
Diffstat (limited to 'layouts')
| -rw-r--r-- | layouts/index.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/layouts/index.html b/layouts/index.html index eddfebb9..6db229d0 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -1,6 +1,56 @@ {{ partial "snippets/document-start.html" . }} <article class="posts"> {{ partial "header.html" . }} + + + <header id="posts-header"> + <div id="post-series"> + <h1>专栏</h1> + <div id="post-series-list"> + {{ range .Site.Params.series }} + <a class="post-series-item" + href="{{ .link }}" + title="{{ .description }}" + data-umami-event="Click series link from index" + > + <div class="post-series-cover"> + <img src="{{ .cover }}" /> + </div> + <div class="post-series-text"> + <h3>{{ .name }}</h3> + </div> + </a> + {{ end }} + </div> + </div> + <div id="posts-recommendation"> + <h1>欢迎</h1> + <script> + const posts = [ + {{ range site.RegularPages }} + "{{ .RelPermalink }}", + {{ end }} + ]; + + function getRandomPost() { + const randomPostLink = document.getElementById("random-post-link") + const randomIndex = Math.floor(Math.random() * posts.length); + randomPostLink.href = posts[randomIndex]; + } + getRandomPost() + </script> + <div id="posts-recommendation-links"> + <a class="button" id="random-post-link" + onclick="getRandomPost()" + >🎲 随机文章</a> + <a class="button" href="https://www.travellings.cn/go.html" + target="_blank">🚇 开往</a> + <a class="button" href="https://www.guhub.cn/" + target="_blank">🏠 我的主页</a> + </div> + </div> + </header> + <div id="posts-list"> {{ $currentYear := now.Format "2006" }} <!-- 获取当前年份 --> |
