Skip to content
This repository was archived by the owner on Apr 20, 2026. It is now read-only.

Commit 91f8610

Browse files
committed
themes: upload hexo-theme-lightx-0.1.1
1 parent 8554198 commit 91f8610

21 files changed

Lines changed: 669 additions & 0 deletions

themes/lightx/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.idea
2+
.vscode

themes/lightx/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Hexo theme lightx
2+
## Features
3+
1. PWA supported.
4+
2. Almost dependency free.
5+
3. Lightweight.
6+
7+
## Config
8+
1. Clone `https://github.com/songquanpeng/hexo-theme-lightx.git` to your hexo blog's theme folder.
9+
2. Edit hexo's configuration file (_config.yml) to apply the theme: around line 76, `theme: hexo-theme-lightx`.
10+
3. Around line 47, disable hexo's highlight by set `enable: false`
11+
4. Replace the images in the source folder (`%THEME_FOLDER%/source`) with your own. Notice image dimensions must meet the requirement.
12+
5. Configure your PWA app name in `%THEME_FOLDER%/source/manifest.json`.

themes/lightx/_config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Your disqus shortname, find it here: https://iometa.disqus.com/admin/settings/general/.
2+
disqus:
3+
# Find your favourite code style here: https://www.jsdelivr.com/package/npm/highlight.js?path=styles.
4+
highlight: https://cdn.jsdelivr.net/npm/highlight.js@9.17.1/styles/railscasts.css
5+
# Enable busuanzi count? It will record your site's pv and uv.
6+
busuanzi: false
7+
# Google analytics id: https://analytics.google.com/analytics/.
8+
analyticsTrackingID:

themes/lightx/layout/archive.ejs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<%
2+
const categoriesList = list_categories({show_count: false});
3+
const tagsList = list_tags({show_count: false});
4+
const archivesList = list_archives({show_count: false});
5+
%>
6+
7+
<article id="archive">
8+
<% if (is_year() === false) { %>
9+
<h2>Tag cloud</h2>
10+
<%- tagcloud({min_font: 16, max_font: 35, amount: 999, color: true, start_color: 'gray', end_color: 'black'}) %>
11+
<% if (categoriesList !== "") { %>
12+
<h2>Categories</h2>
13+
<%- categoriesList %>
14+
<% } %>
15+
<% if (archivesList !== "") { %>
16+
<h2>Archives</h2>
17+
<%- archivesList %>
18+
<% }%>
19+
<% } else { %>
20+
<h1><%= page.month + '/' + page.year %></h1>
21+
<% page.posts.each(article => { %>
22+
<div class="archive-item">
23+
<a href="<%= url_for(article.path) %>">
24+
<%= article.title %>
25+
</a>
26+
<time datetime="<%= date_xml(article.date) %>">
27+
<%= date(article.date) %>
28+
</time>
29+
</div>
30+
<% }) %>
31+
</article>
32+
<% } %>
33+
<%- partial('partials/paginator') %>
34+

themes/lightx/layout/category.ejs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<article id="category">
2+
<h1><%=page.category%></h1>
3+
<% page.posts.each(article => { %>
4+
<div class="category-item">
5+
<a href="<%=url_for(article.path)%>">
6+
<%=article.title%>
7+
</a>
8+
<time datetime="<%=date_xml(article.date)%>">
9+
<%=date(article.date)%>
10+
</time>
11+
</div>
12+
<% }); %>
13+
</article>
14+
<%- partial('partials/paginator') %>
15+

themes/lightx/layout/index.ejs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<% if (page.posts.length > 0) { %>
2+
<% page.posts.sort('date',-1).limit(10).each(post => { %>
3+
<div class="card" onclick="location.href='<%=url_for(post.path)%>'">
4+
<div class="card-title">
5+
<%= post.title %>
6+
</div>
7+
<div class="card-tag">
8+
<% post.tags.forEach(function(tag) { %>
9+
<span class="badge" onclick="event.stopPropagation();location.href='/tags/<%= tag.name.trim().replace(/\s|\./g, '-') %>'"><%= tag.name %></span>
10+
<% }); %>
11+
<span class="badge" onclick="event.stopPropagation();location.href='/archives/<%= date(post.date).split('-').slice(0,2).join('/') %>'"><%=date(post.date)%></span>
12+
<% if(theme.disqus && (theme.disqus.trim() !== "")){%>
13+
<span class="badge" onclick="event.stopPropagation();location.href='<%=url_for(post.path)+`#comment` %>'">
14+
<span class="disqus-comment-count" data-disqus-identifier="<%= post._id %>">0 Comments</span>
15+
</span>
16+
<%}%>
17+
</div>
18+
<div class="card-text">
19+
<%if(post.excerpt){%>
20+
<%- post.excerpt %>
21+
<%}else{%>
22+
<%- truncate(strip_html(post.content), {length: 150, omission: ' ...'}) %>
23+
<%}%>
24+
</div>
25+
</div>
26+
<% }); %> <% } %>
27+
28+
<%- partial('partials/paginator') %>

themes/lightx/layout/layout.ejs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<%
2+
var pageTitle = page.title || config.subtitle || '';
3+
if (is_archive()) pageTitle = 'Archives';
4+
if (is_tag()) pageTitle = 'Tag: ' + page.tag;
5+
if (is_category()) pageTitle = 'Category: ' + page.category;
6+
if (is_month()) pageTitle += ': ' + page.month + '/' + page.year;
7+
if (is_year()) pageTitle += ': ' + page.year;
8+
pageTitle += ' | ' + config.title;
9+
%>
10+
<!DOCTYPE html>
11+
<html lang="<%=config.language%>">
12+
<head>
13+
<meta charset="UTF-8" />
14+
<meta name="viewport" content="width=device-width, initial-scale=1" />
15+
<title><%=pageTitle%></title>
16+
<link rel="stylesheet" href="<%= theme.highlight %>">
17+
<link rel="stylesheet" href="/lightx.css"/>
18+
<link rel="manifest" href="/manifest.json" />
19+
<link rel="apple-touch-icon" href="/icon512.png">
20+
<meta name="theme-color" content="#ffffff"/>
21+
<% if(theme.analyticsTrackingID && (theme.analyticsTrackingID.trim() !== "")){%>
22+
<script async src="https://www.googletagmanager.com/gtag/js?id=<%- theme.analyticsTrackingID.trim() %>"></script>
23+
<script>
24+
window.dataLayer = window.dataLayer || [];
25+
function gtag(){dataLayer.push(arguments);}
26+
gtag('js', new Date());
27+
28+
gtag('config', '<%- theme.analyticsTrackingID.trim() %>');
29+
</script>
30+
<%}%>
31+
</head>
32+
<body>
33+
<script>
34+
if ('serviceWorker' in navigator) {
35+
window.addEventListener('load', function () {
36+
navigator.serviceWorker.register('/sw.js', {scope: '/'})
37+
.then(function (registration) {
38+
// console.log('ServiceWorker registration successful with scope: ', registration.scope);
39+
})
40+
.catch(function (err) {
41+
console.log('ServiceWorker registration failed: ', err);
42+
});
43+
});
44+
}
45+
</script>
46+
<div id="page-container">
47+
<div id="content-wrap">
48+
<div class="wrapper">
49+
<div class="container">
50+
<%-partial('partials/nav')%>
51+
<%- body %>
52+
</div>
53+
</div>
54+
</div>
55+
<div id="footer">
56+
<div class="wrapper">
57+
<div class="container">
58+
<%-partial('partials/footer')%>
59+
</div>
60+
</div>
61+
</div>
62+
</div>
63+
<% if(theme.disqus && (theme.disqus.trim() !== "")){%>
64+
<script id="dsq-count-scr" src="//<%= theme.disqus %>.disqus.com/count.js" async></script>
65+
<%}%>
66+
<% if(theme.busuanzi) {%>
67+
<script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
68+
<%}%>
69+
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@latest/build/highlight.min.js"></script>
70+
<script>
71+
hljs.initHighlightingOnLoad();
72+
</script>
73+
</body>
74+
</html>

themes/lightx/layout/page.ejs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<article>
2+
<h1><%-page.title%></h1>
3+
<div class="contents">
4+
<%- toc(page.content, {list_number:false}) %>
5+
</div>
6+
<%-page.content%>
7+
</article>
8+
<%- partial('partials/comment') %>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<div id="comment">
2+
<% if(theme.disqus && (theme.disqus.trim() !== "")){%>
3+
<div id="disqus_thread"></div>
4+
<script>
5+
var disqus_config = function() {
6+
this.page.url = "<%= page.permalink %>"; // Replace PAGE_URL with your page's canonical URL variable
7+
this.page.identifier = "<%= page._id %>"; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
8+
};
9+
10+
(function() {
11+
var d = document,
12+
s = d.createElement("script");
13+
s.src = "https://<%= theme.disqus %>.disqus.com/embed.js";
14+
s.setAttribute("data-timestamp", +new Date());
15+
(d.head || d.body).appendChild(s);
16+
})();
17+
</script>
18+
<%}%>
19+
</div>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<% let date = new Date(); const year = date.getFullYear();%>
2+
<button id="back-top" onclick="window.scrollTo({top:0,behavior:'smooth'})">TOP</button>
3+
<footer>
4+
<div>
5+
<p>
6+
© <%= year%> <a href="<%= config.url %>"><%=config.author%></a>.
7+
Powered by <a href="https://hexo.io/">Hexo</a>.
8+
Theme <a href="https://github.com/songquanpeng/hexo-theme-lightx">lightx</a>.
9+
<% if(theme.busuanzi) {%>
10+
PV: <span id="busuanzi_value_site_pv"></span>
11+
UV: <span id="busuanzi_value_site_uv"></span>
12+
<%}%>
13+
</p>
14+
</div>
15+
</footer>

0 commit comments

Comments
 (0)