diff options
Diffstat (limited to 'themes/theme/layout')
21 files changed, 478 insertions, 0 deletions
diff --git a/themes/theme/layout/archive.ejs b/themes/theme/layout/archive.ejs new file mode 100644 index 00000000..426f6a86 --- /dev/null +++ b/themes/theme/layout/archive.ejs @@ -0,0 +1 @@ +<%- partial('partials/post_list') %>
\ No newline at end of file diff --git a/themes/theme/layout/category.ejs b/themes/theme/layout/category.ejs new file mode 100644 index 00000000..aad151ae --- /dev/null +++ b/themes/theme/layout/category.ejs @@ -0,0 +1,4 @@ +<div id="category"> + <%- partial('partials/post_gallery') %> +</div> + diff --git a/themes/theme/layout/index.ejs b/themes/theme/layout/index.ejs new file mode 100644 index 00000000..a8c4c3ed --- /dev/null +++ b/themes/theme/layout/index.ejs @@ -0,0 +1 @@ +<%- partial('pages/profile') %>
\ No newline at end of file diff --git a/themes/theme/layout/layout.ejs b/themes/theme/layout/layout.ejs new file mode 100644 index 00000000..4edf6098 --- /dev/null +++ b/themes/theme/layout/layout.ejs @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html lang="<%=config.language%>"> + <head> + <%- partial('partials/head') %> + </head> + <body> + <div class="wrapper"> + + <%- partial('partials/header') %> + + <div class="main"> + <div class="flex-container"> + <%- body %> + </div> + </div> + + <%- partial('partials/footer') %> + + </div> + + <script src="<%- url_for('/js/mermaid-zoom.js') %>"></script> + + </body> +</html> diff --git a/themes/theme/layout/pages/page_head.ejs b/themes/theme/layout/pages/page_head.ejs new file mode 100644 index 00000000..709fd55c --- /dev/null +++ b/themes/theme/layout/pages/page_head.ejs @@ -0,0 +1,14 @@ +<div class="post-head"> + <div class="post-info"> + <div class="post-title"> + + <% if (page.title) {%> + <%= page.title %> + <% } else {%> + *Untitled + <% } %> + + </div> + </div> + <div class="h-line-primary"></div> +</div>
\ No newline at end of file diff --git a/themes/theme/layout/pages/profile.ejs b/themes/theme/layout/pages/profile.ejs new file mode 100644 index 00000000..19f38a05 --- /dev/null +++ b/themes/theme/layout/pages/profile.ejs @@ -0,0 +1,21 @@ +<div class="profile"> + <div class="profile-image"> + <% if (theme.profile.image) {%> + <img src="<%= url_for(theme.profile.image)%>" alt="featured_image"> + <% } %> + </div> + <div class="post-content profile-content"> + <div class="profile-title"> + <%=theme.profile.title%> + </div> + <div class="profile-body"> + <%=theme.profile.body%> + </div> + <% Object.keys(theme.profile.links).forEach(key => { %> + <div class="profile-link"> + <a href="<%= url_for(theme.profile.links[key])%>"><%=key%></a> + </div> + <% }); %> + </div> + +</div>
\ No newline at end of file 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 diff --git a/themes/theme/layout/post.ejs b/themes/theme/layout/post.ejs new file mode 100644 index 00000000..00475498 --- /dev/null +++ b/themes/theme/layout/post.ejs @@ -0,0 +1,14 @@ +<article id="post"> + + <% if (is_post()) {%> + <%- partial('post/post_head') %> + <%- partial('post/post_content') %> + <%- partial('post/post_footer') %> + <% if (!page.hide_comment) {%> + <%- partial('post/post_comment') %> + <% } %> + <%} else {%> + <%- partial('pages/page_head') %> + <%- partial('post/post_content') %> + <%} %> +</article>
\ No newline at end of file diff --git a/themes/theme/layout/post/post_comment.ejs b/themes/theme/layout/post/post_comment.ejs new file mode 100644 index 00000000..60a76fb4 --- /dev/null +++ b/themes/theme/layout/post/post_comment.ejs @@ -0,0 +1,48 @@ +<div class="post-comment"> + + <% if (theme.valine.enable) {%> + <div id="vcomments"></div> + <script> + var META = ['nick', 'mail', 'link']; + var meta = '<%=theme.valine.meta%>'; + meta = meta.split(',').filter(item => { + return META.includes(item); + }); + new Valine({ + el: '#vcomments', + appId: '<%=theme.valine.appId%>', + appKey: '<%=theme.valine.appKey%>', + lang: '<%=theme.valine.lang%>', + placeholder: '<%=theme.valine.placeholder%>', + avatar: '<%=theme.valine.avatar%>', + meta: meta + }) + </script> + <% } %> + + <% if (theme.disqus.enable) {%> + <div id="disqus_thread"></div> + <script> + /** + * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS. + * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables */ + + var disqus_config = function () { + this.page.url = '<%=page.permalink%>'; // Replace PAGE_URL with your page's canonical URL variable + this.page.identifier = '<%=page.path%>'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable + this.language = '<%=theme.disqus.language%>' + }; + + (function() { // DON'T EDIT BELOW THIS LINE + var d = document, s = d.createElement('script'); + s.src = '<%=theme.disqus.disqus_url%>'; + s.setAttribute('data-timestamp', +new Date()); + (d.head || d.body).appendChild(s); + })(); + </script> + <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> + <% } %> + + + +</div>
\ No newline at end of file diff --git a/themes/theme/layout/post/post_content.ejs b/themes/theme/layout/post/post_content.ejs new file mode 100644 index 00000000..e51bc059 --- /dev/null +++ b/themes/theme/layout/post/post_content.ejs @@ -0,0 +1,7 @@ +<div class="post-content"> + <%-page.content%> +</div> + +<script> + window.onload = detectors(); +</script>
\ No newline at end of file diff --git a/themes/theme/layout/post/post_footer.ejs b/themes/theme/layout/post/post_footer.ejs new file mode 100644 index 00000000..c4978890 --- /dev/null +++ b/themes/theme/layout/post/post_footer.ejs @@ -0,0 +1,21 @@ +<div class="post-footer"> + <div class="h-line-primary"></div> + <nav class="post-nav"> + <div class="prev-item"> + <%if (page.prev) {%> + <div class="icon arrow-left"></div> + <div class="post-link"> + <a href="<%=url_for(page.prev.path)%>">Prev</a> + </div> + <%}%> + </div> + <div class="next-item"> + <%if (page.next) {%> + <div class="icon arrow-right"></div> + <div class="post-link"> + <a href="<%=url_for(page.next.path)%>">Next</a> + </div> + <%}%> + </div> + </nav> +</div> diff --git a/themes/theme/layout/post/post_head.ejs b/themes/theme/layout/post/post_head.ejs new file mode 100644 index 00000000..ad821406 --- /dev/null +++ b/themes/theme/layout/post/post_head.ejs @@ -0,0 +1,34 @@ +<div class="post-head"> + <div class="post-info"> + <div class="tag-list"> + <% if (page.tags && page.tags.data && page.tags.data.length > 0) {%> + <% page.tags.data.forEach(function(tag) { %> + <span class="post-tag"> + <a href="<%-url_for(tag.path)%>"> + <%=tag.name%> + </a> + </span> + <% }) %> + <% } %> + </div> + <div class="post-title"> + + <% if (page.title) {%> + <%= page.title %> + <% } else {%> + *Untitled + <% } %> + + </div> + <span class="post-date"> + <%- date(page.date, theme.date_format) %> + </span> + </div> + <div class="post-img"> + <% if (page.featured_image) {%> + <img src="<%= url_for(page.featured_image)%>" alt="featured_image"> + <% } else { %> + <div class="h-line-primary"></div> + <% } %> + </div> +</div>
\ No newline at end of file diff --git a/themes/theme/layout/search.ejs b/themes/theme/layout/search.ejs new file mode 100644 index 00000000..ed7ba50e --- /dev/null +++ b/themes/theme/layout/search.ejs @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<html lang="<%=config.language%>"> + <head> + <%- partial('partials/head') %> + </head> + <body> + <div class="wrapper"> + <%- partial('partials/header') %> + + <div class="main"> + <div class="flex-container"> + <%- body %> + </div> + </div> + + <%- partial('partials/footer') %> + </div> + + <script src="<%- url_for('/js/mermaid-zoom.js') %>"></script> + </body> +</html> diff --git a/themes/theme/layout/tag.ejs b/themes/theme/layout/tag.ejs new file mode 100644 index 00000000..045cc160 --- /dev/null +++ b/themes/theme/layout/tag.ejs @@ -0,0 +1,17 @@ +<div id="tag"> + <% if(is_tag()){ %> + + <p class="tag-title"> + / <a href="<%=url_for(/tag/)%>">tags</a> + / <a href="<%=page.tag.path%>"><%=page.tag%></a> / + </p> + <%- partial('partials/post_list') %> + + <% }else{ %> + + <p class="tag-title">/ tags /</p> + <%- partial('partials/tag_cloud') %> + + <% } %> + +</div>
\ No newline at end of file |
