Skip to content

Commit 0384214

Browse files
committed
refactor: update default themes
1 parent 3027df1 commit 0384214

19 files changed

Lines changed: 114 additions & 60 deletions

File tree

public/default-files/themes/notes/assets/styles/components/footer.less

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,13 @@
33
text-align: center;
44
padding: 40px 24px;
55
color: @oc-gray-6;
6+
display: flex;
7+
justify-content: center;
8+
align-items: center;
69
}
10+
11+
.rss {
12+
display: inline-flex;
13+
align-items: center;
14+
margin-left: 24px;
15+
}

public/default-files/themes/notes/config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,13 @@
168168
"value": "",
169169
"type": "input",
170170
"note": "UA-xxxxxxxxx-x"
171+
},
172+
{
173+
"name": "metaDescription",
174+
"label": "Meta Description",
175+
"group": "SEO",
176+
"value": "",
177+
"type": "input"
171178
}
172179
]
173180
}

public/default-files/themes/notes/templates/archives.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html>
22
<head>
33
<%- include('./includes/head', { siteTitle: themeConfig.siteName }) %>
4+
<meta name="description" content="<%- site.customConfig.metaDescription || themeConfig.siteDescription %>" />
45
</head>
56
<body>
67
<div class="main">
Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,6 @@
11
<div class="site-footer">
2-
<%- themeConfig.footerInfo %> |
3-
<a class="rss" href="<%= themeConfig.domain %>/atom.xml" target="_blank">RSS</a>
2+
<%- themeConfig.footerInfo %>
3+
<a class="rss" href="<%= themeConfig.domain %>/atom.xml" target="_blank">
4+
<i class="ri-rss-line"></i> RSS
5+
</a>
46
</div>
5-
6-
<script>
7-
hljs.initHighlightingOnLoad()
8-
9-
let mainNavLinks = document.querySelectorAll(".markdownIt-TOC a");
10-
11-
// This should probably be throttled.
12-
// Especially because it triggers during smooth scrolling.
13-
// https://lodash.com/docs/4.17.10#throttle
14-
// You could do like...
15-
// window.addEventListener("scroll", () => {
16-
// _.throttle(doThatStuff, 100);
17-
// });
18-
// Only not doing it here to keep this Pen dependency-free.
19-
20-
window.addEventListener("scroll", event => {
21-
let fromTop = window.scrollY;
22-
23-
mainNavLinks.forEach((link, index) => {
24-
let section = document.getElementById(decodeURI(link.hash).substring(1));
25-
let nextSection = null
26-
if (mainNavLinks[index + 1]) {
27-
nextSection = document.getElementById(decodeURI(mainNavLinks[index + 1].hash).substring(1));
28-
}
29-
if (section.offsetTop <= fromTop) {
30-
if (nextSection) {
31-
if (nextSection.offsetTop > fromTop) {
32-
link.classList.add("current");
33-
} else {
34-
link.classList.remove("current");
35-
}
36-
} else {
37-
link.classList.add("current");
38-
}
39-
} else {
40-
link.classList.remove("current");
41-
}
42-
});
43-
});
44-
45-
</script>

public/default-files/themes/notes/templates/includes/head.ejs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
<meta charset="utf-8" />
22
<meta name="viewport" content="width=device-width, initial-scale=1" />
33
<title><%= siteTitle %></title>
4-
<meta name="description" content="<%- themeConfig.siteDescription %>" />
54
<link rel="shortcut icon" href="<%= themeConfig.domain %>/favicon.ico?v=<%= site.utils.now %>">
6-
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
7-
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.css">
5+
<link href="https://cdn.remixicon.com/releases/v2.1.0/remixicon.css" rel="stylesheet">
86
<link rel="stylesheet" href="<%= themeConfig.domain %>/styles/main.css">
9-
10-
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
7+
<link rel="alternate" type="application/atom+xml" title="<%= siteTitle %> - Atom Feed" href="<%= themeConfig.domain %>/atom.xml">
118
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Droid+Serif:400,700">
129

1310
<% if (site.customConfig.ga) { %>

public/default-files/themes/notes/templates/includes/header.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<% ['github', 'twitter', 'weibo', 'zhihu', 'facebook'].forEach((item) => { %>
2626
<% if (site.customConfig[item]) { %>
2727
<a href="<%= site.customConfig[item] %>" target="_blank">
28-
<i class="fab fa-<%= item %>"></i>
28+
<i class="ri-<%= item %>-line"></i>
2929
</a>
3030
<% } %>
3131
<% }) %>

public/default-files/themes/notes/templates/index.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html>
22
<head>
33
<%- include('./includes/head', { siteTitle: themeConfig.siteName }) %>
4+
<meta name="description" content="<%- site.customConfig.metaDescription || themeConfig.siteDescription %>" />
45
</head>
56
<body>
67
<div class="main">

public/default-files/themes/notes/templates/post.ejs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
<html>
22
<head>
33
<%- include('./includes/head', { siteTitle: `${post.title} | ${themeConfig.siteName}` }) %>
4+
<meta name="description" content="<%- post.description %>" />
5+
<meta name="keywords" content="<%- post.tags.map(tag => tag.name).join(',') %>" />
6+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.10.0/katex.min.css">
7+
<script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script>
48
</head>
59
<body>
610
<div class="main">
@@ -62,5 +66,46 @@
6266
<%- include('./includes/footer') %>
6367
</div>
6468
</div>
69+
70+
<script>
71+
hljs.initHighlightingOnLoad()
72+
73+
let mainNavLinks = document.querySelectorAll(".markdownIt-TOC a");
74+
75+
// This should probably be throttled.
76+
// Especially because it triggers during smooth scrolling.
77+
// https://lodash.com/docs/4.17.10#throttle
78+
// You could do like...
79+
// window.addEventListener("scroll", () => {
80+
// _.throttle(doThatStuff, 100);
81+
// });
82+
// Only not doing it here to keep this Pen dependency-free.
83+
84+
window.addEventListener("scroll", event => {
85+
let fromTop = window.scrollY;
86+
87+
mainNavLinks.forEach((link, index) => {
88+
let section = document.getElementById(decodeURI(link.hash).substring(1));
89+
let nextSection = null
90+
if (mainNavLinks[index + 1]) {
91+
nextSection = document.getElementById(decodeURI(mainNavLinks[index + 1].hash).substring(1));
92+
}
93+
if (section.offsetTop <= fromTop) {
94+
if (nextSection) {
95+
if (nextSection.offsetTop > fromTop) {
96+
link.classList.add("current");
97+
} else {
98+
link.classList.remove("current");
99+
}
100+
} else {
101+
link.classList.add("current");
102+
}
103+
} else {
104+
link.classList.remove("current");
105+
}
106+
});
107+
});
108+
109+
</script>
65110
</body>
66111
</html>

public/default-files/themes/notes/templates/tag.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html>
22
<head>
33
<%- include('./includes/head', { siteTitle: `${tag.name} | ${themeConfig.siteName}` }) %>
4+
<meta name="description" content="<%- site.customConfig.metaDescription || themeConfig.siteDescription %>" />
45
</head>
56
<body>
67
<div class="main">

public/default-files/themes/notes/templates/tags.ejs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<html>
22
<head>
33
<%- include('./includes/head', { siteTitle: themeConfig.siteName }) %>
4+
<meta name="description" content="<%- site.customConfig.metaDescription || themeConfig.siteDescription %>" />
45
</head>
56
<body>
67
<div class="main">

0 commit comments

Comments
 (0)