Skip to content

Commit

Permalink
feat(hexo): complete basic layout
Browse files Browse the repository at this point in the history
  • Loading branch information
ourai committed Mar 27, 2023
1 parent 3d57d32 commit 92e02d2
Show file tree
Hide file tree
Showing 276 changed files with 140 additions and 73 deletions.
5 changes: 3 additions & 2 deletions bin/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { resolve: resolvePath } = require('path');
const { ensureDirExists, copyFileDeeply, readData, saveData, execute } = require('./helper');

const SRC_ROOT = resolvePath(__dirname, '../src');
const SA_ROOT = `${SRC_ROOT}/standalone`;
const SA_ROOT = `${SRC_ROOT}/shared`;

function copyAssets(distRoot, polyfill) {
['fonts', 'images', 'javascripts', 'stylesheets'].forEach(dirName => {
Expand All @@ -29,12 +29,13 @@ function copyAssets(distRoot, polyfill) {

['_all', '_bootstrap-custom', '_helper', '_painter'].forEach(fileName => {
const filePath = `${distStyleDirPath}/${fileName}.scss`;
const bsStr = fileName === '_all' ? 'bootstrap-sprockets' : 'bootstrap';

saveData(
filePath,
readData(filePath)
.replace(new RegExp('@import "compass', 'g'), '@import "./polyfills/compass')
.replace(new RegExp('@import "bootstrap', 'g'), '@import "./polyfills/bootstrap')
.replace(new RegExp(`@import "${bsStr}`, 'g'), `@import "./polyfills/${bsStr}`)
.replace(new RegExp('@import "font-awesome', 'g'), '@import "./polyfills/font-awesome'),
);
});
Expand Down
50 changes: 45 additions & 5 deletions src/hexo/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
## Source: https://github.com/hexojs/hexo/

# Site
title: Hexo
subtitle: ''
description: ''
title: Lime
subtitle: 一个简朴、易读、响应式的网站主题。
description: 本主题由欧雷于 2015 年开始设计与开发,并在个人网站「欧雷流」及个人各种开源软件的文档站上使用多年;在设计时以提高阅读体验和保持简洁风格为最高原则,体现个性在其次。适用于博客、个人网站、API 文档站等以内容为主的网站。
keywords:
author: John Doe
language: en
timezone: ''
language: zh-CN
timezone: Asia/Shanghai

# URL
## Set your site url here. For example, if you use GitHub Page, set url as 'https://username.github.io/project'
url: http:https://example.com
root: /lime/
permalink: :year/:month/:day/:title/
permalink_defaults:
pretty_urls:
Expand Down Expand Up @@ -98,6 +99,45 @@ ignore:
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: lime
theme_config:
meta:
url: https://ourai.github.io/lime
brand:
color: "#0871ab"
parent:
text: OOSS
url: https://oss.ourai.ws/
copyright:
owner:
text: 欧雷流
url: https://ourai.ws/
period:
start: 2015
header:
navs:
- text: 文档
url: /guides/
- text: 博客
url: /posts/
- text: 关于
children:
- text: 本站
url: /about/
- text: 作者
url: https://linxoid.com/ourai/
- text: GitHub
url: https://github.com/ourai/lime
navbar:
placement: right
footer:
partial: footer.html
links:
- text: OOSS
url: https://oss.ourai.ws/
- text: 关于
url: /about/
- text: 资助
url: /about/#donation

# Deployment
## Docs: https://hexo.io/docs/one-command-deployment
Expand Down
7 changes: 7 additions & 0 deletions src/hexo/themes/lime/layout/_components/brand-link.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<% let _inc_brand_url = config.root || '/' %>
<% let _inc_brand_text = (theme.brand && theme.brand.text) || config.title %>
<% if (theme.brand && theme.brand.parent) { %>
<a href="<%= theme.brand.parent.url %>?utm_source=<%= theme.meta.url %>&utm_medium=brand" target="_blank" rel="external "><%= theme.brand.parent.text %></a><a href="<%= _inc_brand_url %>"><%= _inc_brand_text %></a>
<% } else { %>
<a <% if (className) { %>class="<%= className %>" <% } %>href="<%= _inc_brand_url %>"><%= _inc_brand_text %></a>
<% } %>
4 changes: 4 additions & 0 deletions src/hexo/themes/lime/layout/_components/copyright.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% let _inc_cr = theme.copyright %><% let _inc_external = false %><% if (_inc_cr) { %><% let _inc_current = date(new Date(), 'YYYY') %><% let _inc_start = (_inc_cr.period && _inc_cr.period.start) || _inc_current %><% let _inc_site_url = config.root || '/' %><% let _inc_url = (_inc_cr.owner && _inc_cr.owner.url) || _inc_site_url %><% if (_inc_url.indexOf('http') === 0) { %>
<% _inc_external = true %><% if (utm) { %><% _inc_url = `${_inc_url}?${utm}` %><% } %>
<% } %>&copy; <% if (_inc_start != _inc_current) { %><%= _inc_start %>-<% } %><%= _inc_current %> <a href="<%= _inc_url %>"<% if (_inc_external) { %> target="_blank" rel="external "<% } %>><%= _inc_cr.owner.text || config.title %></a> 版权所有
<% } %>
1 change: 1 addition & 0 deletions src/hexo/themes/lime/layout/_components/link.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<% let _inc_link_url = 'javascript:void(0);' %><% let _inc_external = false %><% if ((link.url || '').indexOf('http') === 0) { %><% _inc_link_url = `${link.url}?${utm}` %><% _inc_external = true %><% } else if (link.url) { %><% _inc_link_url = `${config.root || '/'}${link.url[0] === '/' ? link.url.slice(1) : link.url}` %><% } %><a href="<%= _inc_link_url %>"<% if (_inc_external) { %> target="_blank" rel="external "<% } %>><% if (wrap === true) { %><span><%= link.text %></span><% } else { %><%= link.text %><% } %></a>
10 changes: 10 additions & 0 deletions src/hexo/themes/lime/layout/_components/nav-list.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<% navs.forEach(_inc_nav => { %>
<% if (_inc_nav.children) { %>
<li class="dropdown">
<a class="dropdown-toggle" href="javascript:void(0);" data-toggle="dropdown"><%= _inc_nav.text %> <span class="caret"></span></a>
<ul class="dropdown-menu"><%- partial('_components/nav-list', { navs: _inc_nav.children }) %></ul>
</li>
<% } else { %>
<li><%- partial('_components/link', { link: _inc_nav, utm: `utm_source=${theme.meta.url}&utm_medium=common-header`, wrap: false }) %></li>
<% } %>
<% }) %>
21 changes: 21 additions & 0 deletions src/hexo/themes/lime/layout/_partials/footer.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<footer class="Page-footer Footer">
<div class="<% if (site.data.local && site.data.local.repos && site.data.local.repos[page.repo]) { %>container-fluid<% } else { %>container<% } %>">
<% let utm_params = `utm_source=${theme.meta.url}&utm_medium=common-footer` %>
<div class="Footer-description">
<% if (theme.footer && (theme.footer.links || []).length > 0) { %>
<!-- Important links -->
<nav class="Footer-navs">
<ul><% theme.footer.links.forEach(link => { %><li><%- partial('_components/link', { link, utm: utm_params, wrap: true }) %></li><% }) %></ul>
</nav>
<% } %>
<% if (theme.copyright) { %>
<!-- Copyright -->
<div class="Footer-copyright">
<p><%- partial('_components/copyright', { utm: utm_params }) %></p>
<% if (theme.copyright.provider !== false) { %><p>本站主题 <a href="https://ourai.github.io/lime/?<%= utm_params %>" target="_blank" rel="external ">Lime</a><a href="https://linxoid.com/ourai/?<%= utm_params %>" target="_blank" rel="external ">欧雷</a> 提供</p><% } %>
<% if (theme.copyright.fragments) { %><%- theme.copyright.fragments %><% } %>
</div>
<% } %>
</div>
</div>
</footer>
8 changes: 4 additions & 4 deletions src/hexo/themes/lime/layout/_partials/head.ejs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<meta charset="UTF-8">
<%- partial("meta/seo") %>
<%- partial("meta/render") %>
<%- partial("meta/feed") %>
<%- partial("meta/brand") %>
<%- partial('meta/seo') %>
<%- partial('meta/render') %>
<%- partial('meta/feed') %>
<%- partial('meta/brand') %>
27 changes: 27 additions & 0 deletions src/hexo/themes/lime/layout/_partials/header.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<header class="Page-header">
<div class="navbar navbar-static-top">
<div class="<% if (site.data.local && site.data.local.repos && site.data.local.repos[page.repo]) { %>container-fluid<% } else { %>container<% } %>">
<div class="navbar-header">
<% if (theme.header && (theme.header.navs || []).length > 0) { %>
<button class="navbar-toggle collapsed" type="button" data-target=".Page-navs" data-toggle="collapse">
<span class="sr-only">Toggle navs</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<% } %>
<% if (theme.brand && theme.brand.parent) { %>
<div class="navbar-brand"><%- partial('_components/brand-link', { className: '' }) %></div>
<% } else { %>
<%- partial('_components/brand-link', { className: 'navbar-brand' }) %>
<% } %>
</div>
<!-- Nav menus -->
<nav class="Page-navs navbar-collapse collapse">
<ul class="nav navbar-nav<% if (theme.header && theme.header.navbar && theme.header.navbar.placement == 'right') { %> navbar-right<% } %>">
<%- partial('_components/nav-list', { navs: ((theme.header && theme.header.navs) || []) }) %>
</ul>
</nav>
</div>
</div>
</header>
2 changes: 1 addition & 1 deletion src/hexo/themes/lime/layout/_partials/meta/brand.ejs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<%- favicon_tag("images/ksio/favicon.ico") %>
<%- favicon_tag('images/ksio/favicon.ico') %>
10 changes: 10 additions & 0 deletions src/hexo/themes/lime/layout/index.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<%- partial('_partials/header') %>
<main class="Page-content" style="height: 100%;">
<div style="height: calc(100% - 271px); display: flex; align-items: center; justify-content: center; text-align: center;">
<div>
<h1 style="margin-top: 0; margin-bottom: .3em; font-size: 10rem; font-weight: 700;"><%= config.title %></h1>
<p style="margin-bottom: 0; font-size: 2.5rem;"><%= config.subtitle || config.description %></p>
</div>
</div>
</main>
<%- partial('_partials/footer') %>
12 changes: 7 additions & 5 deletions src/hexo/themes/lime/layout/layout.ejs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<!DOCTYPE html>
<html lang="<%= config.language %>" dir="ltr">
<head>
<%- partial("_partials/head") %>
<%- css("stylesheets/global") %>
<%- css("stylesheets/pages/home") %>
<%- js("javascripts/ksio/vendors/jquery-1.11.3.min") %>
<%- js("javascripts/ksio/vendors/bootstrap.min") %>
<%- partial('_partials/head') %>
<%- css('stylesheets/global') %>
<% if (page.__index) { %>
<!--%- css('stylesheets/pages/home') %-->
<% } %>
<%- js('javascripts/ksio/vendors/jquery-1.11.3.min') %>
<%- js('javascripts/ksio/vendors/bootstrap.min') %>
</head>
<body class="Page" itemscope itemtype="http:https://schema.org/WebPage"><%- body %></body>
</html>
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
56 changes: 0 additions & 56 deletions src/standalone/stylesheets/polyfills/_bootstrap-custom.scss

This file was deleted.

0 comments on commit 92e02d2

Please sign in to comment.