feat: Add contributors pages.

This commit is contained in:
jaywcjlove 2022-02-14 10:44:19 +08:00
parent c3a24f2a31
commit bc49f6f7e7
4 changed files with 36 additions and 2 deletions

View File

@ -12,6 +12,7 @@ const rootIndexJSPath = path.resolve(process.cwd(), 'template', 'js', 'index.js'
const dataJsonPath = path.resolve(process.cwd(), 'dist', 'data.json'); const dataJsonPath = path.resolve(process.cwd(), 'dist', 'data.json');
const dataJsonMinPath = path.resolve(process.cwd(), 'dist', 'data.min.json'); const dataJsonMinPath = path.resolve(process.cwd(), 'dist', 'data.min.json');
const cssPath = path.resolve(deployDir, 'css', 'index.css'); const cssPath = path.resolve(deployDir, 'css', 'index.css');
const contributorsPath = path.resolve(deployDir, 'CONTRIBUTORS.svg');
;(async () => { ;(async () => {
try { try {
@ -71,6 +72,24 @@ const cssPath = path.resolve(deployDir, 'css', 'index.css');
command_length: jsonData.data.length command_length: jsonData.data.length
} }
); );
let svgStr = '';
if (FS.existsSync(contributorsPath)) {
svgStr = (await FS.readFile(contributorsPath)).toString();
}
await createTmpToHTML(
path.resolve(process.cwd(), 'template', 'contributors.ejs'),
path.resolve(deployDir, 'contributors.html'),
{
p: '/contributors.html',
n: '搜索',
d: '最专业的Linux命令大全命令搜索引擎内容包含Linux命令手册、详解、学习值得收藏的Linux命令速查手册。',
arr: jsonData.data,
command_length: jsonData.data.length,
contributors: svgStr,
}
);
await Promise.all(jsonData.data.map(async (item, idx) => { await Promise.all(jsonData.data.map(async (item, idx) => {
item.command_length = jsonData.data.length; item.command_length = jsonData.data.length;

View File

@ -0,0 +1,8 @@
<%- include('partial/header'); %>
<%- include('widget/search',{type: "list"}); %>
<div class="contributors">
<h1>Contributors</h1>
<div><%=describe.contributors ? describe.contributors : '' %></div>
</div>
<%- include('widget/footer',{type: "list"}); %>
<%- include('partial/footer'); %>

View File

@ -295,11 +295,18 @@ a {
} }
} }
.header_inner, .hotlist, .search_list { .header_inner, .hotlist, .search_list, .contributors {
max-width 920px max-width 920px
margin 0 auto margin 0 auto
} }
.contributors {
padding 79px 27px
a {
font-weight: bold;
}
}
@media mq-mobile { @media mq-mobile {
.header{ .header{
width inherit width inherit

View File

@ -15,5 +15,5 @@
<br /> 共搜集到 <br /> 共搜集到
<span id="commands_info"> <span id="commands_info">
<%=describe.command_length?describe.command_length:''%> <%=describe.command_length?describe.command_length:''%>
</span> 个Linux命令 </span> 个Linux命令,超过 <a href="<%=relative_path%>contributors.html">50+</a> 的贡献者
</div> </div>