diff options
Diffstat (limited to 'themes/theme/layout/partials')
| -rw-r--r-- | themes/theme/layout/partials/back_to_top.ejs | 24 | ||||
| -rw-r--r-- | themes/theme/layout/partials/footer.ejs | 16 | ||||
| -rw-r--r-- | themes/theme/layout/partials/head.ejs | 73 | ||||
| -rw-r--r-- | themes/theme/layout/partials/header.ejs | 42 | ||||
| -rw-r--r-- | themes/theme/layout/partials/paginator.ejs | 14 | ||||
| -rw-r--r-- | themes/theme/layout/partials/post_gallery.ejs | 42 | ||||
| -rw-r--r-- | themes/theme/layout/partials/post_list.ejs | 29 | ||||
| -rw-r--r-- | themes/theme/layout/partials/tag_cloud.ejs | 11 |
8 files changed, 251 insertions, 0 deletions
diff --git a/themes/theme/layout/partials/back_to_top.ejs b/themes/theme/layout/partials/back_to_top.ejs new file mode 100644 index 00000000..df413f52 --- /dev/null +++ b/themes/theme/layout/partials/back_to_top.ejs @@ -0,0 +1,24 @@ +<div id="back-to-top" class="back-to-top"> + <i class="icon-arrow-up"></i> +</div> + +<script> + const backToTop = document.getElementById('back-to-top'); + + // 显示/隐藏回到顶部按钮 + window.addEventListener('scroll', () => { + if (window.pageYOffset > 300) { + backToTop.classList.add('show'); + } else { + backToTop.classList.remove('show'); + } + }); + + // 点击回到顶部 + backToTop.addEventListener('click', () => { + window.scrollTo({ + top: 0, + behavior: 'smooth' + }); + }); +</script>
\ No newline at end of file diff --git a/themes/theme/layout/partials/footer.ejs b/themes/theme/layout/partials/footer.ejs new file mode 100644 index 00000000..6200a376 --- /dev/null +++ b/themes/theme/layout/partials/footer.ejs @@ -0,0 +1,16 @@ +<div class="footer"> + <div class="flex-container"> + <div class="footer-text"> + <% if (theme.footer.other_info.enable) {%> + <%= theme.footer.other_info.content %> + <br> + <% }%> + <% if (theme.footer.copyright_info.enable) {%> + <%= theme.footer.copyright_info.author %> | + <% }%> + <% if (theme.footer.powered_by.enable) {%> + 希望路过的人可以添点柴火让这里暖和点 + <% }%> + </div> + </div> +</div> diff --git a/themes/theme/layout/partials/head.ejs b/themes/theme/layout/partials/head.ejs new file mode 100644 index 00000000..23265719 --- /dev/null +++ b/themes/theme/layout/partials/head.ejs @@ -0,0 +1,73 @@ +<meta charset="UTF-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> +<meta http-equiv="X-UA-Compatible" content="ie=edge"> +<% if(config.author){ %> + <meta name="author" content="<%- config.author %>"> + <% } %> + <% if(config.subtitle){ %> + <meta name="subtitle" content="<%- config.subtitle %>"> + <% } %> + <% if(config.description){ %> + <meta name="description" content="<%- config.description %>"> + <% } %> + <% if(config.keywords){ %> + <meta name="keywords" content="<%- config.keywords %>"> + <% } %> + + <% var title=page.title; if (is_archive()){ title=__('Archive'); if (is_month()){ title + +=': ' + page.year + '/' + page.month; } else if (is_year()){ title +=': ' + + page.year; } } else if (is_category()){ title=__('Category') + ': ' + page.category; + } else if (is_tag()){ title=__('Tag') + ': ' + page.tag; } %> + + <title> + <% if (title){ %> + <%= title %> | <% } %> + <%= config.title %> + </title> + + <%# favicon %> + <% if (theme.favicon){ %> + <link rel="icon" href="<%- url_for(theme.favicon) %>"> + <% } %> + + <%# css list %> + <% if (theme.stylesheets !==undefined && theme.stylesheets.length> + 0) { %> + <!-- stylesheets list from _config.yml --> + <% theme.stylesheets.forEach(url=> { %> + <link rel="stylesheet" href="<%- url_for(url) %>"> + <% }); %> + <% } %> + + <%# font preload - critical slices %> + <link rel="preload" href="<%- url_for('/fonts/latin-base.woff2') %>" as="font" type="font/woff2" crossorigin> + <link rel="preload" href="<%- url_for('/fonts/cjk-common.woff2') %>" as="font" type="font/woff2" crossorigin> + + <%# javascript list %> + <% if (theme.scripts !==undefined && + theme.scripts.length> 0) { %> + <!-- scripts list from _config.yml --> + <% theme.scripts.forEach(url=> { %> + <script + src="<%- url_for(url) %>"></script> + <% }); %> + <% } %> + + <%# mathjax support %> + <% if(theme.mathjax_enable){ + %> + <script + src="https://polyfill.alicdn.com/polyfill.js?features=es6"></script> + <script + id="MathJax-script" + async + src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/mathjax/3.2.0/es5/tex-mml-chtml.js"></script> + <% } %> + + <%# valine comment + support %> + <% if(theme.valine.enable){ + %> + <script + src='https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/valine/1.4.16/Valine.min.js'></script> + <% } %>
\ No newline at end of file diff --git a/themes/theme/layout/partials/header.ejs b/themes/theme/layout/partials/header.ejs new file mode 100644 index 00000000..97752d9e --- /dev/null +++ b/themes/theme/layout/partials/header.ejs @@ -0,0 +1,42 @@ +<div class="header"> + <div class="flex-container"> + <div class="header-inner"> + <div class="site-brand-container"> + <a href="<%= url_for()%>"> + <% if (theme.logo_image.enable) {%> + <img class="logo-img" src="<%= url_for(theme.logo_image.image_path)%>" alt="logo_image"> + <%} else {%> + <%= theme.site_brand_name %> + <% } %> + </a> + </div> + <div id="menu-btn" class="menu-btn" onclick="toggleMenu()"> + 菜单 + </div> + <nav class="site-nav"> + <ul class="menu-list"> + <% Object.keys(theme.menu).forEach(key=> { %> + <% if (url_for(theme.menu[key]) + "index.html"==url_for(page.path)) {%> + <li class="menu-item menu-item-active"> + <a href="<%=url_for(theme.menu[key])%>"> + <%=key%> + </a> + </li> + <%} else {%> + <li class="menu-item"> + <a href="<%=url_for(theme.menu[key])%>"> + <%=key%> + </a> + </li> + <% }%> + <% }); %> + <% if (theme.local_search.enable) {%> + <li class="menu-item"> + <a href="/search">搜索</a> + </li> + <% } %> + </ul> + </nav> + </div> + </div> +</div> diff --git a/themes/theme/layout/partials/paginator.ejs b/themes/theme/layout/partials/paginator.ejs new file mode 100644 index 00000000..41c26391 --- /dev/null +++ b/themes/theme/layout/partials/paginator.ejs @@ -0,0 +1,14 @@ +<% if (page.total > 1){ %> + <div class=paginator> + <div class="h-line-primary"></div> + <nav class="pagination"> + <%- paginator({ + // prev_text: "« Prev", + // next_text: "Next »" + prev_next: false, + end_size: 1, + mid_size: 1, + }) %> + </nav> + </div> +<% } %>
\ No newline at end of file diff --git a/themes/theme/layout/partials/post_gallery.ejs b/themes/theme/layout/partials/post_gallery.ejs new file mode 100644 index 00000000..488270d3 --- /dev/null +++ b/themes/theme/layout/partials/post_gallery.ejs @@ -0,0 +1,42 @@ +<div class="post-gallery"> + <div class="post-gallery-list"> + <% page.posts.each(function (post) { %> + <div class="post-gallery-item"> + <div class="post-info"> + <div class="tag-list"> + <% if (post.tags && post.tags.data && post.tags.data.length > 0) {%> + <% post.tags.data.forEach(function(tag) { %> + <span class="post-tag"> + <a href="<%-url_for(tag.path)%>"> + <%=tag.name%> + </a> + </span> + <% }) %> + <% } %> + </div> + <div class="post-title"> + <a href="<%=url_for(post.path)%>"</a> + <% if (post.title) {%> + <%= post.title %> + <% } else {%> + *Untitled + <% } %> + </a> + </div> + <span class="post-date"> + <%- date(post.date, theme.date_format) %> + </span> + </div> + <div class="post-img"> + <% if (post.featured_image) {%> + <img src="<%= url_for(post.featured_image)%>" alt="featured_image"> + <% } %> + </div> + </div> + <div class="h-line-secondary"></div> + <% }) %> + </div> + <div id="paginator"> + <%- partial('partials/paginator') %> + </div> +</div> diff --git a/themes/theme/layout/partials/post_list.ejs b/themes/theme/layout/partials/post_list.ejs new file mode 100644 index 00000000..df3e8f2e --- /dev/null +++ b/themes/theme/layout/partials/post_list.ejs @@ -0,0 +1,29 @@ +<div class="post-list"> + <% var last_year = ''; %> + <% page.posts.each(function (post) { %> + + <% var cur_year = post.date.year(); %> + + <% if(last_year !== cur_year){ %> + <div class="year-title"><%- cur_year %></div> + <% last_year = cur_year; } %> + + <div class="post-list-item"> + <div class="post-title"> + <a href="<%- url_for(post.path) %>"> + <% if (post.title) {%> + <%= post.title %> + <% } else {%> + *Untitled + <% } %> + </a> + </div> + + <span class="post-date"><%- date(post.date, theme.date_format) %></span> + </div> + + <% }) %> + <div id="paginator"> + <%- partial('partials/paginator') %> + </div> +</div> diff --git a/themes/theme/layout/partials/tag_cloud.ejs b/themes/theme/layout/partials/tag_cloud.ejs new file mode 100644 index 00000000..75d8eef2 --- /dev/null +++ b/themes/theme/layout/partials/tag_cloud.ejs @@ -0,0 +1,11 @@ +<div class="tag-cloud"> + <div class="tag-list"> + <%site.tags.forEach(tag=>{%> + <span class="post-tag"> + <a href="<%-url_for(tag.path)%>"> + <%=tag.name%> + </a> + </span> + <%})%> + </div> +</div>
\ No newline at end of file |
