mirror of
https://gitee.com/huanghongxun/HMCL-docs.git
synced 2026-11-28 09:58:26 +08:00
refactor: refactor to 11ty to support Tencent Cloud EdgeOne Maker
continuous-integration/drone/push Build is failing
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
**
|
||||
!_site/
|
||||
!_site/**
|
||||
!nginx.conf
|
||||
!Dockerfile
|
||||
+49
-29
@@ -1,37 +1,57 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
name: docs
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
concurrency:
|
||||
limit: 1
|
||||
clone:
|
||||
depth: 1
|
||||
trigger:
|
||||
branch: [main]
|
||||
event: [push, custom]
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: ruby:3.4
|
||||
environment:
|
||||
JEKYLL_ENV: production
|
||||
BUNDLE_PATH: vendor/bundle
|
||||
commands:
|
||||
- bundle config mirror.https://rubygems.org https://mirrors.cloud.tencent.com/rubygems
|
||||
- bundle install --verbose
|
||||
- bundle exec jekyll build --trace --verbose
|
||||
volumes:
|
||||
- name: dist
|
||||
path: /drone/src/_site
|
||||
- name: vendor
|
||||
path: /drone/src/vendor
|
||||
- name: jekyll-cache
|
||||
path: /drone/src/.jekyll-cache
|
||||
when:
|
||||
branch: [main]
|
||||
- name: build
|
||||
image: node:24.18.0-bookworm-slim@sha256:6f7b03f7c2c8e2e784dcf9295400527b9b1270fd37b7e9a7285cf83b6951452d
|
||||
environment:
|
||||
COREPACK_NPM_REGISTRY: https://mirrors.cloud.tencent.com/npm
|
||||
commands:
|
||||
- corepack enable
|
||||
- pnpm install --frozen-lockfile
|
||||
- pnpm build
|
||||
|
||||
volumes:
|
||||
- name: dist
|
||||
host:
|
||||
path: /home/ubuntu/docs.hmcl.net/www
|
||||
- name: vendor
|
||||
host:
|
||||
path: /home/ubuntu/docs.hmcl.net/cache/vendor
|
||||
- name: jekyll-cache
|
||||
host:
|
||||
path: /home/ubuntu/docs.hmcl.net/cache/jekyll-cache
|
||||
- name: image
|
||||
image: plugins/kaniko@sha256:c36f0ad14cec5b418f9ef72796d543e82aaaae56e6147fa7d7f23438fa0880c5
|
||||
settings:
|
||||
registry: registry.hmcl.net
|
||||
repo: registry.hmcl.net/image/hmcl-docs
|
||||
username:
|
||||
from_secret: docs_registry_username
|
||||
password:
|
||||
from_secret: docs_registry_password
|
||||
dockerfile: Dockerfile
|
||||
context: .
|
||||
registry_mirrors: [mirror.ccs.tencentyun.com]
|
||||
build_args:
|
||||
- DOCS_REVISION=${DRONE_COMMIT_SHA}
|
||||
tags: [latest]
|
||||
enable_cache: false
|
||||
|
||||
- name: deploy
|
||||
image: appleboy/drone-ssh:1.8.4@sha256:99276dab0dc485e01ce2ffe1faab7af136808ad85734d84762aa46f61f7fb8d9
|
||||
settings:
|
||||
host:
|
||||
from_secret: docs_deploy_host
|
||||
username: docs-deploy
|
||||
key:
|
||||
from_secret: docs_deploy_key
|
||||
fingerprint:
|
||||
from_secret: docs_deploy_fingerprint
|
||||
command_timeout: 5m
|
||||
script_stop: true
|
||||
script:
|
||||
- sudo -H -n /usr/bin/docker-compose -p docshmclnet -f /data/docs.hmcl.net/docker-compose.yml pull nginx
|
||||
- sudo -H -n /usr/bin/docker-compose -p docshmclnet -f /data/docs.hmcl.net/docker-compose.yml up -d --no-deps nginx
|
||||
|
||||
+9
-1
@@ -5,4 +5,12 @@ _site
|
||||
vendor
|
||||
Gemfile.lock
|
||||
.bundle
|
||||
/.idea/
|
||||
/.idea/
|
||||
node_modules/
|
||||
.cache/
|
||||
reports/
|
||||
playwright-report/
|
||||
test-results/
|
||||
.ci/
|
||||
__pycache__/
|
||||
.plans/
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
registry=https://mirrors.cloud.tencent.com/npm/
|
||||
fetch-retry-mintimeout=1000
|
||||
fetch-retry-maxtimeout=5000
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM nginx:1.30.6-alpine@sha256:47928bf67eb62a1863cb08d9ecb52d3e704304ba614eaee17884204677702951
|
||||
ARG DOCS_REVISION=local
|
||||
LABEL net.hmcl.site="docs" org.opencontainers.image.revision="${DOCS_REVISION}"
|
||||
COPY nginx.conf /etc/nginx/nginx.conf
|
||||
COPY _site/ /srv/www/
|
||||
USER 101:101
|
||||
EXPOSE 8080
|
||||
ENTRYPOINT ["nginx"]
|
||||
CMD ["-g", "daemon off;"]
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
# 构建与部署
|
||||
|
||||
使用 Node 24,pnpm 版本由 package.json 固定。
|
||||
|
||||
```sh
|
||||
corepack enable
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm build
|
||||
```
|
||||
|
||||
静态产物位于 `_site/`。本地预览使用 `pnpm dev` 或 `pnpm preview`,默认只监听 `127.0.0.1:4173`;可用 `PORT=4174 pnpm preview` 更换端口。
|
||||
|
||||
构建正式镜像:
|
||||
|
||||
```sh
|
||||
docker build -t hmcl-docs:local .
|
||||
DOCS_IMAGE=hmcl-docs:local docker-compose up -d
|
||||
```
|
||||
|
||||
如现有站点已占用 3005,可使用 `DOCS_PORT=13005 DOCS_IMAGE=hmcl-docs:local docker-compose -p hmcl-docs-preview up -d` 在 `127.0.0.1:13005` 并行预览。
|
||||
|
||||
镜像基于固定摘要的官方 Nginx,仅复制 `_site/` 和 nginx.conf。运行端口为 `127.0.0.1:3005`,使用非 root 用户、只读根文件系统和临时 `/tmp`,不挂载宿主机网页目录,也不包含 Node、Ruby 或源码。
|
||||
|
||||
`.drone.yml` 在 main 推送后依次执行 pnpm 构建、Dockerfile 镜像构建/推送、Compose 更新。镜像构建使用无需特权模式或 Docker socket 的 Kaniko。部署 SSH 密钥在服务器端只允许更新固定的 Nginx Compose 服务,不提供任意 shell。
|
||||
|
||||
Drone 使用的站点专用配置:
|
||||
|
||||
- `docs_registry_username`、`docs_registry_password`:共享 Registry 网关认证,供 Kaniko 插件初始化登录配置及公网回退访问使用;可信内网入口本身不要求登录。
|
||||
- `docs_deploy_host`、`docs_deploy_key`、`docs_deploy_fingerprint`:部署 SSH 地址、受限密钥和主机公钥指纹。
|
||||
- 镜像仓库:`registry.hmcl.net/image/hmcl-docs`;Compose 文件:`/data/docs.hmcl.net/docker-compose.yml`。
|
||||
|
||||
复用现有共享 Registry。构建节点和部署主机通过内网 DNS 将 `registry.hmcl.net` 解析到可信内网入口,使用现有公开可信 HTTPS 证书,不需要额外 CA、关闭证书校验或挂载宿主机配置。Nginx 对可信内网免认证,公网客户端需要 `docker login registry.hmcl.net`;密码由宿主机管理,不写入项目。CI 必须实际验证内网解析与镜像推送,不能仅依赖宿主机 hosts。
|
||||
|
||||
仓库不包含宿主机安装、迁移、试运行、清理或临时发布脚本。源码推送由维护者执行;本地修改不会自动上线。迁移时的比对工具和报告保留在仓库之外。
|
||||
|
||||
原 Markdown、目录、YAML/CSV 数据、布局和公开 URL 保持原用法。站点图片、字体等资源继续位于原 `assets/`,构建先原样复制到 `_site/assets/`。PNG/JPEG/TIFF 在构建时生成额外 WebP,例如 `_site/assets/img/example.png.webp`,通过 `<picture>` 优先加载 WebP、以原图回退。源码已提供的同名 WebP 优先复用,GIF 不自动转换。
|
||||
|
||||
**所有新生成的 WebP 只写入 `_site/`,不回写 `assets/` 或主题目录。** `_site/` 已被 Git 忽略,Docker 镜像直接包含其中的原图、WebP 和 HTML;无需更改 `.md` 图片路径。编码使用 Sharp,质量参数与旧插件一致为 100。旧 WebP 地址在没有对应文件时仍可回退到原图。
|
||||
|
||||
构建不运行旧 Ruby 插件。`theme/minimal-mistakes/prebuilt` 只保留首次迁移需要对齐的编译 CSS 和主题搜索脚本,不包含站点图片或字体副本。当前修改 SCSS 不会自动编译 CSS,需要另行接入样式编译。`theme/compat-code.json` 只保存未修改代码块的高亮 token,正文仍从 Markdown 构建,新代码会重新高亮。
|
||||
@@ -0,0 +1,6 @@
|
||||
import {renderPage} from '../build/site.mjs';
|
||||
|
||||
export default class {
|
||||
data(){return {pagination:{data:'documents',size:1,alias:'document'},permalink:data=>data.document.output,eleventyExcludeFromCollections:true};}
|
||||
async render(data){return renderPage(data.document);}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import YAML from 'yaml';
|
||||
import {parse as csv} from 'csv-parse/sync';
|
||||
|
||||
export const root=process.cwd();
|
||||
export function walk(dir){return fs.existsSync(dir)?fs.readdirSync(dir,{withFileTypes:true}).sort((a,b)=>a.name.localeCompare(b.name,'en')).flatMap(e=>e.isDirectory()?walk(path.join(dir,e.name)):[path.join(dir,e.name)]):[];}
|
||||
export function read(file){return fs.readFileSync(path.resolve(root,file),'utf8');}
|
||||
export function front(text){
|
||||
const m=text.match(/^(?:---|\/\*\s*@frontmatter)\s*\r?\n([\s\S]*?)^(?:---|\*\/)\s*\r?\n?/m);
|
||||
return m&&m.index===0?{data:YAML.parse(m[1])||{},body:text.slice(m[0].length)}:{data:{},body:text};
|
||||
}
|
||||
export function merge(a,b){const out={...a};for(const [k,v] of Object.entries(b))out[k]=v&&typeof v==='object'&&!Array.isArray(v)&&out[k]&&typeof out[k]==='object'&&!Array.isArray(out[k])?merge(out[k],v):v;return out;}
|
||||
export function load(){
|
||||
const config=YAML.parse(read('_config.yml'));
|
||||
const data={};
|
||||
for(const file of walk('theme/minimal-mistakes/_data')){
|
||||
const ext=path.extname(file),name=path.basename(file,ext);
|
||||
if(['.yml','.yaml'].includes(ext))data[name]=YAML.parse(read(file));
|
||||
}
|
||||
for(const file of walk('_data')){
|
||||
const ext=path.extname(file),name=path.basename(file,ext);
|
||||
if(['.yml','.yaml'].includes(ext))data[name]=merge(data[name]||{},YAML.parse(read(file)));
|
||||
if(ext==='.csv')data[name]=csv(read(file),{columns:true,skip_empty_lines:true,bom:true}).map(row=>Object.fromEntries(Object.entries(row).map(([k,v])=>[k,v===''?null:v])));
|
||||
}
|
||||
const site={...config,data,posts:[],related_posts:[],time:new Date(process.env.SOURCE_DATE_EPOCH?Number(process.env.SOURCE_DATE_EPOCH)*1000:Date.now()).toISOString()};
|
||||
const documents=[],urlMap=new Map();
|
||||
function doc(file,collection){
|
||||
const {data:meta,body}=front(read(file));let defaults={};
|
||||
for(const d of config.defaults||[]){const s=d.scope||{};if((!s.type||s.type===collection)&&(!s.path||file.startsWith(s.path)))defaults=merge(defaults,d.values||{});}
|
||||
const p=merge(defaults,meta);p.path=file;p.relative_path=file;p.collection=collection||p.collection;p.explicitDate=!!p.date;
|
||||
if(collection&&!p.date)p.date=new Date(process.env.SOURCE_DATE_EPOCH?Number(process.env.SOURCE_DATE_EPOCH)*1000:fs.statSync(file).mtimeMs).toISOString();
|
||||
p.slug=path.basename(file,path.extname(file));
|
||||
p.url=p.permalink||(collection?(collection==='docs'?`/${p.slug}.html`:`/${collection}/${file.slice(collection.length+2).replace(/\.md$/,'.html')}`):`/${p.slug}.html`);
|
||||
if(file==='index.md')p.url='/';
|
||||
if(file==='404.md')p.url='/404.html';
|
||||
p.output=p.url.endsWith('/')?`${p.url}index.html`:p.url;
|
||||
p.raw=body;p.content=body;p.id=p.url.replace(/\.html$/,'');
|
||||
documents.push(p);urlMap.set('/'+file,p.url);return p;
|
||||
}
|
||||
for(const name of Object.keys(config.collections)){
|
||||
site[name]=walk('_'+name).filter(f=>f.endsWith('.md')).map(f=>doc(f,name));
|
||||
site[name].sort((a,b)=>(a.explicitDate&&b.explicitDate?(Date.parse(a.date)||0)-(Date.parse(b.date)||0):0)||(a.path<b.path?-1:a.path>b.path?1:0));
|
||||
site[name].forEach((p,i,items)=>{const adjacent=x=>x?{url:x.url,title:x.title}:null;p.previous=adjacent(items[i-1]);p.next=adjacent(items[i+1]);});
|
||||
if(config.collections[name].output===false)for(const p of site[name])p.hiddenOutput=true;
|
||||
}
|
||||
for(const file of [...walk('_pages').filter(f=>f.endsWith('.md')),'index.md','404.md','settings.yaml'])doc(file);
|
||||
const index=front(read('index.json'));
|
||||
const redirects=walk('redirects').filter(f=>/\.ya?ml$/.test(f)).map(f=>front(read(f)).data);
|
||||
for(const p of documents)for(const from of [].concat(p.redirect_from||[]))redirects.push({permalink:from,redirect_to:p.url});
|
||||
return {site,config,documents,urlMap,index,redirects};
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import sharp from 'sharp';
|
||||
import {walk} from './content.mjs';
|
||||
|
||||
// The plan reads source assets; conversion writes exclusively to the build output.
|
||||
export function planImages(directory='assets',publicPath='/assets'){
|
||||
const urls=new Map(),pending=[];
|
||||
for(const source of walk(directory)){
|
||||
const relative=path.relative(directory,source).split(path.sep).join('/');
|
||||
const url=publicPath+'/'+relative;
|
||||
if(fs.existsSync(source+'.webp'))urls.set(url,url+'.webp');
|
||||
else if(/\.(png|jpe?g|tiff?)$/i.test(source)){
|
||||
urls.set(url,url+'.webp');
|
||||
pending.push({source,relative:relative+'.webp'});
|
||||
}
|
||||
}
|
||||
return {urls,pending};
|
||||
}
|
||||
|
||||
export async function writeWebp(output,plan){
|
||||
const pending=[...plan.pending];
|
||||
// Bound CPU/memory use on the shared CI host. Match the old encoder's quality=100.
|
||||
await Promise.all(Array.from({length:2},async()=>{
|
||||
while(pending.length){
|
||||
const {source,relative}=pending.shift(),target=path.join(output,'assets',relative);
|
||||
fs.mkdirSync(path.dirname(target),{recursive:true});
|
||||
await sharp(source).webp({quality:100}).toFile(target);
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import MarkdownIt from 'markdown-it';
|
||||
import attrs from 'markdown-it-attrs';
|
||||
import footnotes from 'markdown-it-footnote';
|
||||
import hljs from 'highlight.js';
|
||||
import {load as html} from 'cheerio';
|
||||
import fs from 'node:fs';
|
||||
import crypto from 'node:crypto';
|
||||
import {planImages} from './images.mjs';
|
||||
|
||||
const escape=s=>String(s).replaceAll('&','&').replaceAll('<','<').replaceAll('>','>').replaceAll('"','"');
|
||||
export function makeMarkdown(model){
|
||||
const codeCache=JSON.parse(fs.readFileSync('theme/compat-code.json','utf8')).entries;
|
||||
const images=model.images??=planImages();
|
||||
const md=new MarkdownIt({html:true,breaks:false,linkify:false,typographer:true,quotes:'“”‘’',xhtmlOut:true}).use(attrs).use(footnotes);
|
||||
md.normalizeLink=s=>s.replace(/ /g,'%20');
|
||||
md.renderer.rules.s_open=()=>'<del>';md.renderer.rules.s_close=()=>'</del>';
|
||||
md.renderer.rules.ordered_list_open=(ts,i,opts,env,self)=>{ts[i].attrs=(ts[i].attrs||[]).filter(([k])=>k!=='start');return self.renderToken(ts,i,opts);};
|
||||
md.renderer.rules.heading_open=(ts,i,opts,env,self)=>{ts[i].attrSet('data-hmcl-heading','');return self.renderToken(ts,i,opts);};
|
||||
md.renderer.rules.table_open=()=>'<table data-hmcl-table="">\n';
|
||||
const footLabel=(t,e)=>e.footnotes.list[t.meta.id]?.label||String(t.meta.id+1);
|
||||
md.renderer.rules.footnote_ref=(ts,i,o,e)=>{const t=ts[i],label=footLabel(t,e),suffix=t.meta.subId?':'+t.meta.subId:'';return `<sup id="fnref:${label}${suffix}"><a href="#fn:${label}" class="footnote" rel="footnote" role="doc-noteref">${t.meta.id+1}</a></sup>`;};
|
||||
md.renderer.rules.footnote_block_open=()=>'<div class="footnotes" role="doc-endnotes"><ol>';
|
||||
md.renderer.rules.footnote_block_close=()=>'</ol></div>';
|
||||
md.renderer.rules.footnote_open=(ts,i,o,e)=>`<li id="fn:${footLabel(ts[i],e)}">`;
|
||||
md.renderer.rules.footnote_anchor=(ts,i,o,e)=>` <a href="#fnref:${footLabel(ts[i],e)}" class="reversefootnote" role="doc-backlink">↩</a>`;
|
||||
md.core.ruler.disable(['replacements','smartquotes']);
|
||||
// Separate typographic symbols from text just as Kramdown's AST does.
|
||||
// This matters when its GitHub-reference plugin wraps one text node in a span.
|
||||
const typographyBoundary='\uE000';
|
||||
md.renderer.rules.text=(ts,i)=>escape(ts[i].content).replaceAll(typographyBoundary,'<!-- HMCL_TYPOGRAPHY -->');
|
||||
md.core.ruler.after('inline','kramdown_typography',state=>{
|
||||
const symbol=s=>typographyBoundary+s+typographyBoundary;
|
||||
function visit(tokens){for(const token of tokens){
|
||||
if(token.type==='text')token.content=token.content.replace(/\.\.\./g,()=>symbol('…')).replace(/---/g,()=>symbol('—')).replace(/--/g,()=>symbol('–')).replace(/["']/g,(q,i,s)=>{
|
||||
const prev=s[i-1]||'',next=s[i+1]||'';
|
||||
const close=(prev&&!/[\s\\\[{(\-]/.test(prev))||!next||/\s/.test(next)||next==='s'&&!/\w/.test(s[i+2]||'');
|
||||
return symbol(q==='"'?(close?'”':'“'):(close?'’':'‘'));
|
||||
});
|
||||
if(token.children)visit(token.children);
|
||||
}}visit(state.tokens);
|
||||
});
|
||||
// Kramdown accepts emphasis delimiters next to CJK/punctuation where CommonMark differs.
|
||||
md.inline.ruler.before('emphasis','kramdown_emphasis',(state,silent)=>{
|
||||
if(state.src[state.pos]!=='*')return false;
|
||||
const width=state.src[state.pos+1]==='*'?2:1,marker='*'.repeat(width),start=state.pos+width;
|
||||
if(/\s/.test(state.src[start]||' '))return false;
|
||||
let end=state.src.indexOf(marker,start);
|
||||
while(end>=0&&(/\s/.test(state.src[end-1])||(width===1&&(state.src[end+1]==='*'||state.src[end-1]==='*'))))end=state.src.indexOf(marker,end+width);
|
||||
if(end<0)return false;
|
||||
if(!silent){const tag=width===2?'strong':'em';state.push(tag+'_open',tag,1);state.md.inline.parse(state.src.slice(start,end),state.md,state.env,state.tokens);state.push(tag+'_close',tag,-1);}
|
||||
state.pos=end+width;return true;
|
||||
});
|
||||
md.renderer.rules.code_inline=(ts,i)=>`<code class="language-plaintext highlighter-rouge">${escape(ts[i].content)}</code>`;
|
||||
md.renderer.rules.fence=(ts,i)=>{
|
||||
const t=ts[i],lang=t.info.trim().split(/\s/)[0]||'plaintext';
|
||||
const key=lang+':'+crypto.createHash('sha256').update(t.content).digest('hex');
|
||||
let content=codeCache[key]??escape(t.content);
|
||||
if(!Object.hasOwn(codeCache,key)&&hljs.getLanguage(lang)&&lang!=='plaintext')content=hljs.highlight(t.content,{language:lang,ignoreIllegals:true}).value.replace(/class="hljs-([^" ]+)(?: [^"]*)?"/g,(_,name)=>`class="${({keyword:'k',built_in:'nb',type:'kt',literal:'kc',number:'mi',string:'s',comment:'c',title:'nf',attr:'na',variable:'nv',meta:'cp',params:'n',symbol:'ss',regexp:'sr',punctuation:'p',operator:'o'})[name]||'n'}"`);
|
||||
return `<div class="language-${lang} highlighter-rouge"${t.info.includes('hmcl-tight-li')?' data-hmcl-tight-list=""':''}><div class="highlight"><pre class="highlight"><code>${content}</code></pre></div></div>\n`;
|
||||
};
|
||||
function relative(input){
|
||||
if(typeof input!=='string')return input;
|
||||
const match=input.match(/^([^?#]*)([?#][\s\S]*)?$/),base=match[1];
|
||||
return (model.urlMap.get(base)||base)+(match[2]||'');
|
||||
}
|
||||
function render(source){
|
||||
let tocInline=false;
|
||||
source=String(source??'').replace(/<!---->/g,'').replace(/^(\s*\d+)\)/gm,'$1\\)').replace(/\* This will become a table of contents[\s\S]*?\{:\s*toc\s*\}/g,()=>{tocInline=true;return '<!-- HMCL_INLINE_TOC -->';});
|
||||
source=source.replace(/^(\d+\. [^\n]*\n)(```[^\n]*\n[\s\S]*?\n```)/gm,(_,item,code)=>item+code.replace(/\n/,' hmcl-tight-li\n').split('\n').map(line=>' '+line).join('\n'));
|
||||
// Kramdown block attribute lists attach to the preceding block.
|
||||
source=source.replace(/^\{:\s*([^}]+)\}\s*$/gm,(_,a)=>`\n<hmcl-attrs data-attrs="${escape(a.trim())}"></hmcl-attrs>\n`);
|
||||
let result=md.render(source);
|
||||
const $=html(result,null,false),ids=new Map();
|
||||
$('table[data-hmcl-table]').removeAttr('data-hmcl-table').find('td').each((_,e)=>{if(!$(e).contents().length)$(e).html(' ');});
|
||||
$('h1[id=""],h2[id=""],h3[id=""],h4[id=""],h5[id=""],h6[id=""]').removeAttr('id');
|
||||
$('li > p:first-child').each((_,e)=>{const p=$(e);if(p.siblings('[data-hmcl-tight-list]').length&&p.parent().children('p').length===1)p.replaceWith(p.html());});
|
||||
$('[data-hmcl-tight-list]').removeAttr('data-hmcl-tight-list');
|
||||
if(/<li[ >]/.test(source))$('li').each((_,e)=>{
|
||||
const el=$(e);if(el.find('br,table,ul,ol,p').length||!el.text().includes(' | '))return;
|
||||
const cells=el.text().split(/\s*\|\s*/);el.html(`<table><tbody><tr>${cells.map(s=>`<td>${escape(s)}</td>`).join('')}</tr></tbody></table>`);
|
||||
});
|
||||
$('hmcl-attrs').each((_,e)=>{
|
||||
const marker=$(e),container=marker.parent().is('p')&&marker.parent().text().trim()===''?marker.parent():marker,prev=container.prev();
|
||||
for(const item of marker.attr('data-attrs').match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g)||[]){if(item.startsWith('.'))prev.addClass(item.slice(1));else if(item.startsWith('#'))prev.attr('id',item.slice(1));}
|
||||
container.remove();
|
||||
});
|
||||
$('[data-hmcl-heading]').each((_,e)=>{
|
||||
$(e).removeAttr('data-hmcl-heading');
|
||||
const el=$(e);if(el.attr('id'))return;
|
||||
let id=el.text().trim().toLowerCase().replace(/\s/g,'-').replace(/[^\p{L}\p{N}\p{M}_-]/gu,'');
|
||||
if(!id)id='section';const n=ids.get(id)||0;ids.set(id,n+1);el.attr('id',id+(n?`-${n}`:''));
|
||||
});
|
||||
$('blockquote').each((_,e)=>{
|
||||
const q=$(e),p=q.children('p').first();if(!p.length)return;
|
||||
const first=p.contents().first();if(first[0]?.type!=='text')return;
|
||||
const m=first.text().match(/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\](?:\n|$)/i);
|
||||
if(m){q.addClass({'note':'notice--info','tip':'notice--success','important':'notice--primary','warning':'notice--warning','caution':'notice--danger'}[m[1].toLowerCase()]);first[0].data=first[0].data.slice(m[0].length);}
|
||||
});
|
||||
$('a[href],img[src],script[src]').each((_,e)=>{const el=$(e),a=e.name==='a'?'href':'src';el.attr(a,relative(el.attr(a)));});
|
||||
$('img').each((_,e)=>{
|
||||
const el=$(e),src=el.attr('src');
|
||||
if(el.closest('picture').length||!src?.startsWith('/'))return;
|
||||
const [,pathname,suffix]=src.match(/^([^?#]*)(.*)$/);
|
||||
let original;try{original=decodeURI(pathname);}catch{return;}
|
||||
const webp=images.urls.get(original);if(!webp)return;
|
||||
el.wrap('<picture></picture>').before(` <source srcset="${escape(webp.replaceAll(' ','%20')+suffix)}" type="image/webp"> `);
|
||||
const previous=el.parent()[0].prev;
|
||||
if(previous?.type==='text')previous.data=previous.data.replace(/\s+$/,'');
|
||||
});
|
||||
function autolinks(parent){
|
||||
for(const child of [...(parent.children||[])]){
|
||||
if(child.type==='tag'&&['code','pre','script','style','a'].includes(child.name))continue;
|
||||
if(child.type==='text'&&/\b(?:GP-\d+|GC-[0-9a-f]{7})\b/.test(child.data)){
|
||||
const value=escape(child.data).replace(/\b(GP-(\d+)|GC-([0-9a-f]{7}))\b/g,(_,all,pr,sha)=>`<a href="https://github.com/HMCL-dev/HMCL/${pr?'pull/'+pr:'commit/'+sha}" target="_blank">${all}</a>`);
|
||||
// Kramdown emits an HTML span on its own indented line, including
|
||||
// separating whitespace around adjacent inline elements.
|
||||
$(child).replaceWith(` <span>${value}</span> `);
|
||||
}else if(child.children)autolinks(child);
|
||||
}
|
||||
}
|
||||
autolinks($.root()[0]);
|
||||
result=$.html().replaceAll('<!-- HMCL_TYPOGRAPHY -->','');
|
||||
if(tocInline)result=result.replace('<!-- HMCL_INLINE_TOC -->',inlineTOC(result));
|
||||
return result;
|
||||
}
|
||||
function inlineTOC(content){return `<aside class="sidebar__right"><nav class="toc"><header><h4 class="nav__title"><i class="fas fa-file-alt"></i> 目录</h4></header>${toc(content,'toc__menu','markdown-toc')}</nav></aside>`;}
|
||||
function toc(content,cls='toc__menu',id){
|
||||
const $=html(content,null,false);const heads=$('h1,h2,h3,h4,h5,h6').toArray().filter(e=>$(e).attr('id')&&!$(e).hasClass('no_toc'));
|
||||
if(!heads.length)return '';
|
||||
let out='',level=0,base=Number(heads[0].name.slice(1));
|
||||
for(const h of heads){if(Number(h.name.slice(1))<base)continue;const n=Number(h.name.slice(1))-base+1;
|
||||
if(n>level){for(let i=level;i<n;i++)out+=i===0?`<ul class="${cls}"${id?` id="${id}"`:''}>`:'<ul>';}
|
||||
else if(n<level){for(let i=n;i<level;i++)out+='</li></ul>';out+='</li>';}
|
||||
else out+='</li>';
|
||||
out+=`<li><a href="#${escape($(h).attr('id'))}"${id?` id="${id}-${escape($(h).attr('id'))}"`:''}>${escape($(h).text())}</a>`;level=n;
|
||||
}
|
||||
for(let i=0;i<level;i++)out+='</li></ul>';return out;
|
||||
}
|
||||
return {render,relative,toc,inlineTOC};
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {Liquid} from 'liquidjs';
|
||||
import {minify} from 'html-minifier-terser';
|
||||
import {front,read} from './content.mjs';
|
||||
import {makeMarkdown} from './markdown.mjs';
|
||||
|
||||
export function renderer(model){
|
||||
const markdown=makeMarkdown(model);
|
||||
const liquid=new Liquid({jsTruthy:false,strictFilters:true,strictVariables:false,dynamicPartials:false,dateTimezoneOffset:480});
|
||||
const cache=new Map();
|
||||
function includeFile(name){
|
||||
name=name.replace(/^\//,'');if(name.includes('..'))throw Error('Invalid include path');
|
||||
for(const base of ['_includes','theme/minimal-mistakes/_includes'])for(const ext of ['', '.html']){const p=path.join(base,name+ext);if(fs.existsSync(p))return read(p);}
|
||||
throw Error('Missing include: '+name);
|
||||
}
|
||||
for(const tag of ['include','include_cached'])liquid.registerTag(tag,{
|
||||
parse(token){
|
||||
const match=token.args.match(/^(\S+)\s*([\s\S]*)$/);this.name=match[1].replace(/^['"]|['"]$/g,'');this.args=[];
|
||||
const regex=/(\w+)\s*=\s*("[^"]*"|'[^']*'|[^\s]+)/g;let m;
|
||||
while((m=regex.exec(match[2])))this.args.push([m[1],m[2]]);
|
||||
},
|
||||
*render(ctx){
|
||||
if(this.name==='toc'&&!this.args.length)return '<!-- HMCL_INLINE_TOC -->';
|
||||
const args={};for(const [k,v] of this.args)args[k]=yield liquid.evalValue(v,ctx);
|
||||
if(this.name==='toc.html')return markdown.toc(args.html||'',args.class||'toc__menu',args.id);
|
||||
const source=includeFile(this.name);if(!cache.has(source))cache.set(source,liquid.parse(source));
|
||||
return yield liquid.render(cache.get(source),{...ctx.getAll(),include:args});
|
||||
}
|
||||
});
|
||||
liquid.registerFilter('markdownify',s=>markdown.render(s));
|
||||
liquid.registerFilter('relative_url',s=>typeof s==='string'?`${model.site.baseurl||''}${markdown.relative(s)}`:s);
|
||||
liquid.registerFilter('absolute_url',s=>s===undefined||s===null?'':new URL(markdown.relative(String(s)),model.site.url+'/').href);
|
||||
liquid.registerFilter('jsonify',s=>JSON.stringify(s??null));
|
||||
liquid.registerFilter('date_to_xmlschema',s=>typeof s==='string'?s.replace(' ','T').replace(/\s([+-]\d\d)(\d\d)$/,'$1:$2'):new Date(s).toISOString());
|
||||
liquid.registerFilter('version_sort',(xs,key)=>[...(xs||[])].sort((a,b)=>{const x=a[key].split('.').map(Number),y=b[key].split('.').map(Number);for(let i=0;i<Math.max(x.length,y.length);i++){const n=(x[i]||0)-(y[i]||0);if(n)return n;}return 0;}));
|
||||
liquid.registerFilter('number_of_words',s=>String(s||'').trim().split(/\s+/).length);
|
||||
liquid.registerFilter('smartify',s=>s);
|
||||
liquid.registerFilter('normalize_whitespace',s=>String(s||'').replace(/\s+/g,' '));
|
||||
const context=(p,extra={})=>({site:model.site,page:p,jekyll:{environment:'production'},...extra});
|
||||
async function template(s,p,extra){return liquid.parseAndRender(s,context(p,extra));}
|
||||
async function body(p){
|
||||
let value=await template(p.raw,p);
|
||||
value=markdown.render(value);
|
||||
value=value.replace('<!-- HMCL_INLINE_TOC -->',markdown.inlineTOC(value));
|
||||
return value;
|
||||
}
|
||||
async function page(p){
|
||||
let content=p.rendered;let name=p.layout;const seen=new Set();
|
||||
while(name&&name!=='compress'){
|
||||
if(seen.has(name))throw Error('Cyclic layout '+name);seen.add(name);
|
||||
let file=['_layouts','theme/minimal-mistakes/_layouts'].map(d=>path.join(d,name+'.html')).find(f=>fs.existsSync(f));
|
||||
if(!file)throw Error('Missing layout '+name);
|
||||
const layout=front(read(file));content=await template(layout.body,p,{content,layout:layout.data});name=layout.data.layout;
|
||||
}
|
||||
content=content.replace(/<p class="page__meta">[\s\S]*?<\/p>/g,p=>p.replace(/\s+/g,' ').replace(/ +<\/p>/g,'</p>'));
|
||||
const result=await minify(content,{collapseWhitespace:true,ignoreCustomFragments:[/<p class="page__meta">[\s\S]*?<\/p>/,/<picture>[\s\S]*?<\/picture>/],removeComments:true,keepClosingSlash:true,caseSensitive:true,removeOptionalTags:false});
|
||||
return result.replace(/<br\s*\/?>(?!\s)/g,'<br /> ');
|
||||
}
|
||||
return {liquid,markdown,template,body,page};
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {minify as minifyJS} from 'terser';
|
||||
import {load,walk,read,front} from './content.mjs';
|
||||
import {renderer} from './render.mjs';
|
||||
import {writeWebp} from './images.mjs';
|
||||
|
||||
let state;
|
||||
export async function prepare(){
|
||||
if(state)return state;
|
||||
const model=load(),r=renderer(model);state={model,r};
|
||||
for(const p of model.documents){p.rendered=await r.body(p);p.content=p.rendered;}
|
||||
return state;
|
||||
}
|
||||
export async function renderPage(p){return (await prepare()).r.page(p);}
|
||||
const xml=s=>String(s??'').replaceAll('&','&').replaceAll('<','<').replaceAll('>','>').replaceAll('"','"');
|
||||
function output(out,file,value){const p=path.join(out,file.replace(/^\//,''));fs.mkdirSync(path.dirname(p),{recursive:true});fs.writeFileSync(p,value);}
|
||||
export async function assets(out){
|
||||
const {model,r}=await prepare();
|
||||
for(const dir of ['theme/minimal-mistakes/assets','theme/minimal-mistakes/prebuilt/assets','assets'])for(const file of walk(dir)){
|
||||
const rel=path.relative(dir,file);if(/\.(?:scss|map)$/.test(rel))continue;
|
||||
const p=path.join(out,'assets',rel);fs.mkdirSync(path.dirname(p),{recursive:true});fs.copyFileSync(file,p);
|
||||
}
|
||||
fs.copyFileSync('favicon.ico',path.join(out,'favicon.ico'));
|
||||
for(const [target,inputs] of Object.entries(model.config.post_process.terser)){
|
||||
const code=[];
|
||||
for(const input of inputs){
|
||||
const source=['.'+input,'theme/minimal-mistakes'+input].find(f=>fs.existsSync(f));if(!source)throw Error('Missing script '+input);
|
||||
const original=read(source),parsed=front(original);
|
||||
code.push(parsed.body===original?original:await r.template(parsed.body,{url:input,layout:null}));
|
||||
}
|
||||
const result=await minifyJS(code.join(';'));output(out,target,result.code);
|
||||
}
|
||||
for(const p of [...model.config.post_process.remove_files,...model.config.post_process.remove_dirs])fs.rmSync(path.join(out,p.replace(/^\//,'')),{force:true,recursive:true});
|
||||
// Styles are deliberately pinned to the published version for the first migration.
|
||||
const cssDir='theme/minimal-mistakes/prebuilt/assets/css';
|
||||
for(const p of walk(cssDir))output(out,'assets/css/'+path.relative(cssDir,p),fs.readFileSync(p));
|
||||
await writeWebp(out,model.images);
|
||||
const index=await r.template(model.index.body,model.index.data);JSON.parse(index);output(out,'index.json',index);
|
||||
const redirects={};
|
||||
for(const d of model.redirects){
|
||||
const to=d.redirect_to.startsWith('/')?model.site.url+d.redirect_to:d.redirect_to;redirects[d.permalink]=to;
|
||||
output(out,d.permalink,`<!DOCTYPE html>\n<html lang="en-US">\n <meta charset="utf-8">\n <title>Redirecting…</title>\n <link rel="canonical" href="${xml(to)}">\n <script>location=${JSON.stringify(to)}</script>\n <meta http-equiv="refresh" content="0; url=${xml(to)}">\n <meta name="robots" content="noindex">\n <h1>Redirecting…</h1>\n <a href="${xml(to)}">Click here if you are not redirected.</a>\n</html>\n`);
|
||||
}
|
||||
output(out,'redirects.json',JSON.stringify(redirects));
|
||||
const date=s=>s?r.liquid.filters.date_to_xmlschema(s):model.site.time;
|
||||
const feed=(collection)=>{
|
||||
const file=collection?`feed/${collection}.xml`:'feed.xml';const url=model.site.url+'/'+file;
|
||||
const docs=collection?[...model.site[collection]].filter(p=>p.date).sort((a,b)=>new Date(a.date)-new Date(b.date)).reverse().slice(0,10):[];
|
||||
const entries=docs.map(p=>`<entry><title type="html">${xml(xml(p.title))}</title><link href="${xml(model.site.url+p.url)}" rel="alternate" type="text/html" title="${xml(p.title)}"/><published>${date(p.date)}</published><updated>${date(p.last_modified_at||p.date)}</updated><id>${xml(model.site.url+p.id)}</id><content type="html" xml:base="${xml(model.site.url+p.url)}"><![CDATA[${p.rendered.replaceAll(']]>',']]]]><![CDATA[>')}]]></content>${p.author?`<author><name>${xml(p.author)}</name></author>`:''}${p.excerpt?`<summary type="html">${xml(r.markdown.render(p.excerpt).trim())}</summary>`:''}</entry>`).join('');
|
||||
output(out,file,`<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom"><generator uri="https://www.11ty.dev/">Eleventy</generator><link href="${url}" rel="self" type="application/atom+xml"/><link href="${model.site.url}/" rel="alternate" type="text/html"/><updated>${model.site.time}</updated><id>${url}</id><title type="html">${xml(model.site.title+(collection?' | '+collection[0].toUpperCase()+collection.slice(1):''))}</title><subtitle>${xml(model.site.description)}</subtitle>${entries}</feed>`);
|
||||
};
|
||||
feed();for(const name of model.config.feed.collections)feed(name);
|
||||
const urls=model.documents.filter(p=>!p.hiddenOutput).map(p=>p.url).concat(Object.keys(redirects));
|
||||
output(out,'sitemap.xml',`<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">${urls.map(u=>`<url><loc>${xml(model.site.url+u)}</loc></url>`).join('')}</urlset>`);
|
||||
output(out,'robots.txt',`Sitemap: ${model.site.url}/sitemap.xml\n`);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
version: "2.4"
|
||||
services:
|
||||
nginx:
|
||||
image: "${DOCS_IMAGE:-registry.hmcl.net/image/hmcl-docs:latest}"
|
||||
restart: unless-stopped
|
||||
user: "101:101"
|
||||
entrypoint: [nginx]
|
||||
command: [-g, "daemon off;"]
|
||||
ports: ["127.0.0.1:${DOCS_PORT:-3005}:8080"]
|
||||
read_only: true
|
||||
tmpfs: ["/tmp:rw,noexec,nosuid,size=16m,mode=1777"]
|
||||
cap_drop: [ALL]
|
||||
security_opt: ["no-new-privileges:true"]
|
||||
pids_limit: 64
|
||||
mem_limit: 128m
|
||||
healthcheck:
|
||||
test: [CMD, wget, -q, -O, /dev/null, "http://127.0.0.1:8080/"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
stop_signal: SIGQUIT
|
||||
stop_grace_period: 10s
|
||||
logging:
|
||||
driver: json-file
|
||||
options: {max-size: "10m", max-file: "3"}
|
||||
@@ -0,0 +1,7 @@
|
||||
import {prepare,assets} from './build/site.mjs';
|
||||
|
||||
export default function(config){
|
||||
config.addGlobalData('documents',async()=> (await prepare()).model.documents.filter(p=>!p.hiddenOutput));
|
||||
config.on('eleventy.after',async({dir})=>assets(dir.output));
|
||||
return {dir:{input:'_eleventy',output:'_site'},templateFormats:['11ty.js']};
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
worker_processes auto;
|
||||
pid /tmp/nginx.pid;
|
||||
error_log /dev/stderr warn;
|
||||
|
||||
events { worker_connections 512; }
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
access_log /dev/stdout;
|
||||
server_tokens off;
|
||||
sendfile on;
|
||||
keepalive_timeout 30;
|
||||
client_body_temp_path /tmp/client;
|
||||
proxy_temp_path /tmp/proxy;
|
||||
fastcgi_temp_path /tmp/fastcgi;
|
||||
uwsgi_temp_path /tmp/uwsgi;
|
||||
scgi_temp_path /tmp/scgi;
|
||||
|
||||
server {
|
||||
listen 8080;
|
||||
server_name _;
|
||||
root /srv/www;
|
||||
index index.html;
|
||||
absolute_redirect off;
|
||||
autoindex off;
|
||||
error_page 404 /404.html;
|
||||
add_header X-Content-Type-Options nosniff always;
|
||||
add_header Cache-Control "no-cache" always;
|
||||
location / { try_files $uri $uri/ =404; }
|
||||
# Preserve legacy generated-image URLs without storing converted images.
|
||||
location ~ ^/assets/.+\.(?:png|jpe?g|gif|tiff?)\.webp$ {
|
||||
try_files $uri @original_image;
|
||||
}
|
||||
location @original_image {
|
||||
rewrite ^(/assets/.+\.(?:png|jpe?g|gif|tiff?))\.webp$ $1 permanent;
|
||||
}
|
||||
location ~ /\. { deny all; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "hmcl-docs",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@10.34.9",
|
||||
"engines": {
|
||||
"node": ">=24 <25"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node tools/build.mjs",
|
||||
"dev": "node tools/dev.mjs",
|
||||
"preview": "node tools/serve.mjs",
|
||||
"test": "node --test tests/*.test.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@11ty/eleventy": "3.1.7",
|
||||
"cheerio": "1.2.0",
|
||||
"csv-parse": "7.0.3",
|
||||
"highlight.js": "11.12.0",
|
||||
"html-minifier-terser": "7.2.0",
|
||||
"liquidjs": "10.30.1",
|
||||
"markdown-it": "15.0.3",
|
||||
"markdown-it-attrs": "5.0.1",
|
||||
"markdown-it-footnote": "4.0.0",
|
||||
"sharp": "0.35.5",
|
||||
"terser": "5.51.2",
|
||||
"yaml": "2.9.1"
|
||||
}
|
||||
}
|
||||
Generated
+1657
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
overrides:
|
||||
'@11ty/recursive-copy>minimatch': 11.0.3
|
||||
@@ -0,0 +1,69 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import {createRequire} from 'node:module';
|
||||
import {load as dom} from 'cheerio';
|
||||
import {load,front} from '../build/content.mjs';
|
||||
import {renderer} from '../build/render.mjs';
|
||||
|
||||
const model=load(),r=renderer(model);
|
||||
const copy=createRequire(import.meta.resolve('@11ty/eleventy'))('@11ty/recursive-copy');
|
||||
test('patched glob dependency remains compatible with Eleventy passthrough copying',async()=>{
|
||||
const dir=fs.mkdtempSync(path.join(os.tmpdir(),'hmcl-copy-'));
|
||||
try{
|
||||
const input=path.join(dir,'in'),output=path.join(dir,'out');fs.mkdirSync(path.join(input,'nested'),{recursive:true});
|
||||
for(const file of ['a.txt','nested/b.txt','nested/drop.tmp','.hidden'])fs.writeFileSync(path.join(input,file),file);
|
||||
await copy(input,output,{dot:true,filter:['**/*','!**/*.tmp']});
|
||||
for(const file of ['a.txt','nested/b.txt','.hidden'])assert.equal(fs.readFileSync(path.join(output,file),'utf8'),file);
|
||||
assert.equal(fs.existsSync(path.join(output,'nested/drop.tmp')),false);
|
||||
}finally{fs.rmSync(dir,{recursive:true,force:true});}
|
||||
});
|
||||
test('published URLs preserve root docs, folder indexes and non-public changelog entries',()=>{
|
||||
assert.equal(model.documents.find(p=>p.path==='_docs/faq.md').url,'/faq.html');
|
||||
assert.equal(model.documents.find(p=>p.path==='_launcher/isolation.md').url,'/launcher/isolation.html');
|
||||
assert.equal(model.documents.find(p=>p.path==='_pages/launcher.md').output,'/launcher/index.html');
|
||||
assert.ok(model.documents.filter(p=>p.hiddenOutput).length>=246);
|
||||
});
|
||||
test('existing front matter and JavaScript comment front matter are both supported',()=>{
|
||||
assert.deepEqual(front('/* @frontmatter\nlayout: null\n*/\nwindow.test = 1;'),{data:{layout:null},body:'window.test = 1;'});
|
||||
assert.equal(front('---\ntitle: 例子\n---\n原文').body,'原文');
|
||||
});
|
||||
test('links resolve source paths and fragments without altering code examples',()=>{
|
||||
const $=dom(r.markdown.render('[文档](/_docs/help.md?q=1#问题) `/_docs/help.md`'));
|
||||
assert.equal($('a').attr('href'),'/help.html?q=1#问题');
|
||||
assert.equal($('code').text(),'/_docs/help.md');
|
||||
});
|
||||
test('GitHub references only link outside code and existing links',()=>{
|
||||
const $=dom(r.markdown.render('GP-123 GC-abcdef0 `GP-456` [GP-789](https://example.com)'));
|
||||
assert.equal($('a[href="https://github.com/HMCL-dev/HMCL/pull/123"]').length,1);
|
||||
assert.equal($('a[href="https://github.com/HMCL-dev/HMCL/commit/abcdef0"]').length,1);
|
||||
assert.equal($('code a').length,0);assert.equal($('a a').length,0);
|
||||
});
|
||||
test('GitHub reference spans preserve Kramdown spacing around inline code and links',()=>{
|
||||
const result=r.markdown.render('GP-123: 支持 `.jar` ([示例](https://example.com))');
|
||||
assert.match(result,/支持 <\/span> <code/);
|
||||
assert.match(result,/<\/code> \(<a/);
|
||||
});
|
||||
test('notice attributes, Chinese anchors and nested emphasis preserve Kramdown conventions',()=>{
|
||||
const $=dom(r.markdown.render('> [!WARNING]\n> 请注意\n\n## Terracotta | 陶瓦联机\n\n*请安装 **Fabric API** 。*\n\n> 原文\n\n{: .notice--info }'));
|
||||
assert.equal($('blockquote.notice--warning').text().trim(),'请注意');
|
||||
assert.equal($('h2').attr('id'),'terracotta--陶瓦联机');
|
||||
assert.equal($('em strong').text(),'Fabric API');
|
||||
assert.equal($('blockquote.notice--info').text().trim(),'原文');
|
||||
});
|
||||
test('version ordering is numeric rather than lexical',()=>{
|
||||
const a=[{slug:'3.9.0'},{slug:'3.10.0'},{slug:'3.2.114'}];
|
||||
assert.deepEqual(r.liquid.filters.version_sort(a,'slug').map(x=>x.slug),['3.2.114','3.9.0','3.10.0']);
|
||||
});
|
||||
test('unknown/new code blocks render from source rather than old page HTML',()=>{
|
||||
const source='const newlyAdded = "测试 <tag>";\n';
|
||||
const $=dom(r.markdown.render('```javascript\n'+source+'```'));
|
||||
assert.equal($('pre code').text(),source);assert.equal($('tag').length,0);
|
||||
});
|
||||
test('CSV empty status is absent, while translated theme defaults are merged',()=>{
|
||||
assert.ok(model.site.data.groups.some(p=>p.status===null));
|
||||
assert.equal(model.site.data['ui-text'].zh.skip_primary_nav,'转到主导航栏');
|
||||
assert.equal(model.site.data['ui-text'].zh.follow_label,false);
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import sharp from 'sharp';
|
||||
import {load as html} from 'cheerio';
|
||||
import {planImages,writeWebp} from '../build/images.mjs';
|
||||
import {load} from '../build/content.mjs';
|
||||
import {renderer} from '../build/render.mjs';
|
||||
|
||||
test('WebP encoding writes only to output, preserves originals and reuses provided alternatives',async()=>{
|
||||
const dir=fs.mkdtempSync(path.join(os.tmpdir(),'hmcl-webp-'));
|
||||
try{
|
||||
const source=path.join(dir,'source'),out=path.join(dir,'output');fs.mkdirSync(source);
|
||||
const image=sharp({create:{width:17,height:11,channels:4,background:'#12345680'}});
|
||||
await image.clone().png().toFile(path.join(source,'new.png'));
|
||||
await image.clone().png().toFile(path.join(source,'provided.png'));
|
||||
await image.clone().webp().toFile(path.join(source,'provided.png.webp'));
|
||||
await image.clone().gif().toFile(path.join(source,'animation.gif'));
|
||||
const original=new Map(fs.readdirSync(source).map(name=>[name,fs.readFileSync(path.join(source,name))]));
|
||||
const plan=planImages(source);
|
||||
fs.cpSync(source,path.join(out,'assets'),{recursive:true});
|
||||
await writeWebp(out,plan);
|
||||
const metadata=await sharp(path.join(out,'assets/new.png.webp')).metadata();
|
||||
assert.equal(metadata.format,'webp');assert.equal(metadata.width,17);assert.equal(metadata.height,11);assert.equal(metadata.hasAlpha,true);
|
||||
assert.deepEqual(fs.readdirSync(source).sort(),[...original.keys()].sort());
|
||||
for(const [name,bytes] of original){
|
||||
assert.deepEqual(fs.readFileSync(path.join(source,name)),bytes);
|
||||
assert.deepEqual(fs.readFileSync(path.join(out,'assets',name)),bytes);
|
||||
}
|
||||
assert.equal(plan.urls.get('/assets/new.png'),'/assets/new.png.webp');
|
||||
assert.equal(plan.urls.get('/assets/provided.png'),'/assets/provided.png.webp');
|
||||
assert.equal(fs.existsSync(path.join(out,'assets/animation.gif.webp')),false);
|
||||
}finally{fs.rmSync(dir,{recursive:true,force:true});}
|
||||
});
|
||||
|
||||
test('picture prefers WebP and retains the original image and authored picture markup',()=>{
|
||||
const model=load();model.images={urls:new Map([['/assets/demo.png','/assets/demo.png.webp']]),pending:[]};
|
||||
const r=renderer(model);
|
||||
const $=html(r.markdown.render(''));
|
||||
assert.equal($('picture source').attr('type'),'image/webp');
|
||||
assert.equal($('picture source').attr('srcset'),'/assets/demo.png.webp?v=1');
|
||||
assert.equal($('picture img').attr('src'),'/assets/demo.png?v=1');
|
||||
assert.equal($('picture img').attr('alt'),'原图');assert.equal($('picture img').attr('title'),'说明');
|
||||
const explicit=html(r.markdown.render('<picture><source srcset="/own.avif" type="image/avif"><img src="/assets/demo.png"></picture>'));
|
||||
assert.equal(explicit('picture').length,1);assert.equal(explicit('source').attr('srcset'),'/own.avif');
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
kramdown - fast, pure-Ruby Markdown-superset converter
|
||||
Copyright (C) 2009-2013 Thomas Leitner <t_leitner@gmx.at>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
Some test cases and the benchmark files are based on test cases from
|
||||
the MDTest test suite:
|
||||
|
||||
MDTest
|
||||
Copyright (c) 2007 Michel Fortin
|
||||
<http://www.michelf.com/>
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
# -*- coding: utf-8; frozen_string_literal: true -*-
|
||||
#
|
||||
#--
|
||||
# Copyright (C) 2009-2026 Thomas Leitner <t_leitner@gmx.at>
|
||||
#
|
||||
# This file is part of kramdown which is licensed under the MIT.
|
||||
#++
|
||||
#
|
||||
#--
|
||||
# Parts of this file are based on code from RubyPants:
|
||||
#
|
||||
# = RubyPants -- SmartyPants ported to Ruby
|
||||
#
|
||||
# Ported by Christian Neukirchen <mailto:chneukirchen@gmail.com>
|
||||
# Copyright (C) 2004 Christian Neukirchen
|
||||
#
|
||||
# Incooporates ideas, comments and documentation by Chad Miller
|
||||
# Copyright (C) 2004 Chad Miller
|
||||
#
|
||||
# Original SmartyPants by John Gruber
|
||||
# Copyright (C) 2003 John Gruber
|
||||
#
|
||||
#
|
||||
# = RubyPants -- SmartyPants ported to Ruby
|
||||
#
|
||||
#
|
||||
# [snip]
|
||||
#
|
||||
# == Authors
|
||||
#
|
||||
# John Gruber did all of the hard work of writing this software in
|
||||
# Perl for Movable Type and almost all of this useful documentation.
|
||||
# Chad Miller ported it to Python to use with Pyblosxom.
|
||||
#
|
||||
# Christian Neukirchen provided the Ruby port, as a general-purpose
|
||||
# library that follows the *Cloth API.
|
||||
#
|
||||
#
|
||||
# == Copyright and License
|
||||
#
|
||||
# === SmartyPants license:
|
||||
#
|
||||
# Copyright (c) 2003 John Gruber
|
||||
# (http://daringfireball.net)
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# * Neither the name "SmartyPants" nor the names of its contributors
|
||||
# may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# This software is provided by the copyright holders and contributors
|
||||
# "as is" and any express or implied warranties, including, but not
|
||||
# limited to, the implied warranties of merchantability and fitness
|
||||
# for a particular purpose are disclaimed. In no event shall the
|
||||
# copyright owner or contributors be liable for any direct, indirect,
|
||||
# incidental, special, exemplary, or consequential damages (including,
|
||||
# but not limited to, procurement of substitute goods or services;
|
||||
# loss of use, data, or profits; or business interruption) however
|
||||
# caused and on any theory of liability, whether in contract, strict
|
||||
# liability, or tort (including negligence or otherwise) arising in
|
||||
# any way out of the use of this software, even if advised of the
|
||||
# possibility of such damage.
|
||||
#
|
||||
# === RubyPants license
|
||||
#
|
||||
# RubyPants is a derivative work of SmartyPants and smartypants.py.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# This software is provided by the copyright holders and contributors
|
||||
# "as is" and any express or implied warranties, including, but not
|
||||
# limited to, the implied warranties of merchantability and fitness
|
||||
# for a particular purpose are disclaimed. In no event shall the
|
||||
# copyright owner or contributors be liable for any direct, indirect,
|
||||
# incidental, special, exemplary, or consequential damages (including,
|
||||
# but not limited to, procurement of substitute goods or services;
|
||||
# loss of use, data, or profits; or business interruption) however
|
||||
# caused and on any theory of liability, whether in contract, strict
|
||||
# liability, or tort (including negligence or otherwise) arising in
|
||||
# any way out of the use of this software, even if advised of the
|
||||
# possibility of such damage.
|
||||
#
|
||||
# == Links
|
||||
#
|
||||
# John Gruber:: http://daringfireball.net
|
||||
# SmartyPants:: http://daringfireball.net/projects/smartypants
|
||||
#
|
||||
# Chad Miller:: http://web.chad.org
|
||||
#
|
||||
# Christian Neukirchen:: http://kronavita.de/chris
|
||||
#
|
||||
#++
|
||||
#
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2024 Michael Rose and contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,12 @@
|
||||
# main links
|
||||
main:
|
||||
- title: "Quick-Start Guide"
|
||||
url: https://mmistakes.github.io/minimal-mistakes/docs/quick-start-guide/
|
||||
# - title: "About"
|
||||
# url: https://mmistakes.github.io/minimal-mistakes/about/
|
||||
# - title: "Sample Posts"
|
||||
# url: /year-archive/
|
||||
# - title: "Sample Collections"
|
||||
# url: /collection-archive/
|
||||
# - title: "Sitemap"
|
||||
# url: /sitemap/
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
<!-- start custom analytics snippet -->
|
||||
|
||||
<!-- end custom analytics snippet -->
|
||||
@@ -0,0 +1,9 @@
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.analytics.google.tracking_id }}"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', '{{ site.analytics.google.tracking_id }}', { 'anonymize_ip': {{ site.analytics.google.anonymize_ip | default: false }}});
|
||||
</script>
|
||||
@@ -0,0 +1,7 @@
|
||||
<script>
|
||||
window.ga=function(){ga.q.push(arguments)};ga.q=[];ga.l=+new Date;
|
||||
ga('create','{{ site.analytics.google.tracking_id }}','auto');
|
||||
ga('set', 'anonymizeIp', {{ site.analytics.google.anonymize_ip | default: false }});
|
||||
ga('send','pageview')
|
||||
</script>
|
||||
<script src="https://www.google-analytics.com/analytics.js" async></script>
|
||||
@@ -0,0 +1,14 @@
|
||||
<script>
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '{{ site.analytics.google.tracking_id }}']);
|
||||
{% if site.analytics.google.anonymize_ip == true %}
|
||||
_gaq.push(['_gat._anonymizeIp']);
|
||||
{% endif %}
|
||||
_gaq.push(['_trackPageview']);
|
||||
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,15 @@
|
||||
<script src="https://swetrix.org/swetrix.js" defer></script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
swetrix.init("{{ site.analytics.swetrix.tracking_id }}");
|
||||
swetrix.trackViews();
|
||||
});
|
||||
</script>
|
||||
|
||||
<noscript>
|
||||
<img
|
||||
src="https://api.swetrix.com/log/noscript?pid={{ site.analytics.swetrix.tracking_id }}"
|
||||
alt=""
|
||||
referrerpolicy="no-referrer-when-downgrade"
|
||||
/>
|
||||
</noscript>
|
||||
@@ -0,0 +1,16 @@
|
||||
{% if jekyll.environment == 'production' and site.analytics.provider and page.analytics != false %}
|
||||
|
||||
{% case site.analytics.provider %}
|
||||
{% when "google" %}
|
||||
{% include /analytics-providers/google.html %}
|
||||
{% when "google-universal" %}
|
||||
{% include /analytics-providers/google-universal.html %}
|
||||
{% when "google-gtag" %}
|
||||
{% include /analytics-providers/google-gtag.html %}
|
||||
{% when "swetrix" %}
|
||||
{% include /analytics-providers/swetrix.html %}
|
||||
{% when "custom" %}
|
||||
{% include /analytics-providers/custom.html %}
|
||||
{% endcase %}
|
||||
|
||||
{% endif %}
|
||||
@@ -0,0 +1,31 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if post.header.teaser %}
|
||||
{% capture teaser %}{{ post.header.teaser }}{% endcapture %}
|
||||
{% else %}
|
||||
{% assign teaser = site.teaser %}
|
||||
{% endif %}
|
||||
|
||||
{% if post.id %}
|
||||
{% assign title = post.title | markdownify | remove: "<p>" | remove: "</p>" %}
|
||||
{% else %}
|
||||
{% assign title = post.title %}
|
||||
{% endif %}
|
||||
|
||||
<div class="{{ include.type | default: 'list' }}__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork"{% if post.locale %} lang="{{ post.locale }}"{% endif %}>
|
||||
{% if include.type == "grid" and teaser %}
|
||||
<div class="archive__item-teaser">
|
||||
<img src="{{ teaser | relative_url }}" alt="">
|
||||
</div>
|
||||
{% endif %}
|
||||
<h2 class="archive__item-title no_toc p-name" itemprop="headline">
|
||||
{% if post.link %}
|
||||
<a href="{{ post.link }}">{{ title }}</a> <a class="u-url" href="{{ post.url | relative_url }}" rel="permalink"><i class="fas fa-link" aria-hidden="true" title="permalink"></i><span class="sr-only">Permalink</span></a>
|
||||
{% else %}
|
||||
<a class="u-url" href="{{ post.url | relative_url }}" rel="permalink">{{ title }}</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% include page__meta.html locale=locale type=include.type %}
|
||||
{% if post.excerpt %}<p class="archive__item-excerpt p-summary" itemprop="description">{{ post.excerpt | markdownify | strip_html | truncate: 160 }}</p>{% endif %}
|
||||
</article>
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<!--
|
||||
<li>
|
||||
<a href="http://link-to-whatever-social-network.com/user/" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fas fa-fw" aria-hidden="true"></i> Custom Social Profile Link
|
||||
</a>
|
||||
</li>
|
||||
-->
|
||||
@@ -0,0 +1,247 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign author = page.author | default: page.authors[0] | default: site.author %}
|
||||
{% assign author = site.data.authors[author] | default: author %}
|
||||
|
||||
<div itemscope itemtype="https://schema.org/Person" class="h-card">
|
||||
|
||||
{% if author.avatar %}
|
||||
<div class="author__avatar">
|
||||
<a href="{{ author.home | default: '/' | absolute_url }}">
|
||||
<img src="{{ author.avatar | relative_url }}" alt="{{ author.name }}" itemprop="image" class="u-photo">
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="author__content">
|
||||
<h3 class="author__name p-name" itemprop="name">
|
||||
<a class="u-url" rel="me" href="{{ author.home | default: '/' | absolute_url }}" itemprop="url">{{ author.name }}</a>
|
||||
</h3>
|
||||
{% if author.bio %}
|
||||
<div class="author__bio p-note" itemprop="description">
|
||||
{{ author.bio | markdownify }}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="author__urls-wrapper">
|
||||
<button class="btn btn--inverse">{{ site.data.ui-text[locale].follow_label | remove: ":" | default: "Follow" }}</button>
|
||||
<ul class="author__urls social-icons">
|
||||
{% if author.location %}
|
||||
<li itemprop="homeLocation" itemscope itemtype="https://schema.org/Place">
|
||||
<i class="fas fa-fw fa-location-dot" aria-hidden="true"></i> <span itemprop="name" class="p-locality">{{ author.location }}</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.links %}
|
||||
{% for link in author.links %}
|
||||
{% if link.label and link.url %}
|
||||
<li><a href="{{ link.url }}" rel="nofollow noopener noreferrer me"{% if link.url contains 'http' %} itemprop="sameAs"{% endif %}><i class="{{ link.icon | default: 'fas fa-link' }}" aria-hidden="true"></i><span class="label">{{ link.label }}</span></a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% if author.uri %}
|
||||
<li>
|
||||
<a href="{{ author.uri }}" itemprop="url" rel="me">
|
||||
<i class="fas fa-fw fa-link" aria-hidden="true"></i><span class="label">{{ site.data.ui-text[locale].website_label | default: "Website" }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.email %}
|
||||
<li>
|
||||
<a href="mailto:{{ author.email }}" rel="me" class="u-email">
|
||||
<meta itemprop="email" content="{{ author.email }}" />
|
||||
<i class="fas fa-fw fa-square-envelope" aria-hidden="true"></i><span class="label">{{ site.data.ui-text[locale].email_label | default: "Email" }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.keybase %}
|
||||
<li>
|
||||
<a href="https://keybase.io/{{ author.keybase }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-keybase" aria-hidden="true"></i><span class="label">Keybase</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.twitter %}
|
||||
<li>
|
||||
<a href="https://twitter.com/{{ author.twitter }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-square-x-twitter" aria-hidden="true"></i><span class="label">Twitter</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.facebook %}
|
||||
<li>
|
||||
<a href="https://www.facebook.com/{{ author.facebook }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-square-facebook" aria-hidden="true"></i><span class="label">Facebook</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.linkedin %}
|
||||
<li>
|
||||
<a href="https://www.linkedin.com/in/{{ author.linkedin }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-linkedin" aria-hidden="true"></i><span class="label">LinkedIn</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.xing %}
|
||||
<li>
|
||||
<a href="https://www.xing.com/profile/{{ author.xing }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-square-xing" aria-hidden="true"></i><span class="label">XING</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.instagram %}
|
||||
<li>
|
||||
<a href="https://instagram.com/{{ author.instagram }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-instagram" aria-hidden="true"></i><span class="label">Instagram</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.tumblr %}
|
||||
<li>
|
||||
<a href="https://{{ author.tumblr }}.tumblr.com" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-square-tumblr" aria-hidden="true"></i><span class="label">Tumblr</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.bitbucket %}
|
||||
<li>
|
||||
<a href="https://bitbucket.org/{{ author.bitbucket }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-bitbucket" aria-hidden="true"></i><span class="label">Bitbucket</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.github %}
|
||||
<li>
|
||||
<a href="https://github.com/{{ author.github }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-github" aria-hidden="true"></i><span class="label">GitHub</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.gitlab %}
|
||||
<li>
|
||||
<a href="https://gitlab.com/{{ author.gitlab }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-gitlab" aria-hidden="true"></i><span class="label">GitLab</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.stackoverflow %}
|
||||
<li>
|
||||
<a href="https://stackoverflow.com/users/{{ author.stackoverflow }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-stack-overflow" aria-hidden="true"></i><span class="label">Stack Overflow</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.lastfm %}
|
||||
<li>
|
||||
<a href="https://last.fm/user/{{ author.lastfm }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-square-lastfm" aria-hidden="true"></i><span class="label">Last.fm</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.dribbble %}
|
||||
<li>
|
||||
<a href="https://dribbble.com/{{ author.dribbble }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-dribbble" aria-hidden="true"></i><span class="label">Dribbble</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.pinterest %}
|
||||
<li>
|
||||
<a href="https://www.pinterest.com/{{ author.pinterest }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-pinterest" aria-hidden="true"></i><span class="label">Pinterest</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.foursquare %}
|
||||
<li>
|
||||
<a href="https://foursquare.com/{{ author.foursquare }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-foursquare" aria-hidden="true"></i><span class="label">Foursquare</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.steam %}
|
||||
<li>
|
||||
<a href="https://steamcommunity.com/id/{{ author.steam }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-steam" aria-hidden="true"></i><span class="label">Steam</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.youtube %}
|
||||
{% if author.youtube contains "://" %}
|
||||
<li>
|
||||
<a href="{{ author.youtube }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-youtube" aria-hidden="true"></i><span class="label">YouTube</span>
|
||||
</a>
|
||||
</li>
|
||||
{% elsif author.youtube %}
|
||||
<li>
|
||||
<a href="https://www.youtube.com/user/{{ author.youtube }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-youtube" aria-hidden="true"></i><span class="label">YouTube</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if author.soundcloud %}
|
||||
<li>
|
||||
<a href="https://soundcloud.com/{{ author.soundcloud }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-soundcloud" aria-hidden="true"></i><span class="label">SoundCloud</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.weibo %}
|
||||
<li>
|
||||
<a href="https://www.weibo.com/{{ author.weibo }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-weibo" aria-hidden="true"></i><span class="label">Weibo</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.flickr %}
|
||||
<li>
|
||||
<a href="https://www.flickr.com/{{ author.flickr }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-flickr" aria-hidden="true"></i><span class="label">Flickr</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.codepen %}
|
||||
<li>
|
||||
<a href="https://codepen.io/{{ author.codepen }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-codepen" aria-hidden="true"></i><span class="label">CodePen</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if author.vine %}
|
||||
<li>
|
||||
<a href="https://vine.co/u/{{ author.vine }}" itemprop="sameAs" rel="nofollow noopener noreferrer me">
|
||||
<i class="fab fa-fw fa-vine" aria-hidden="true"></i><span class="label">{{ site.data.ui-text[locale].email_label | default: "Email" }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% include author-profile-custom-links.html %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,41 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% case site.category_archive.type %}
|
||||
{% when "liquid" %}
|
||||
{% assign path_type = "#" %}
|
||||
{% when "jekyll-archives" %}
|
||||
{% assign path_type = nil %}
|
||||
{% endcase %}
|
||||
|
||||
{% if page.collection != 'posts' %}
|
||||
{% assign path_type = nil %}
|
||||
{% assign crumb_path = '/' %}
|
||||
{% else %}
|
||||
{% assign crumb_path = site.category_archive.path %}
|
||||
{% endif %}
|
||||
|
||||
<nav class="breadcrumbs" aria-label="Breadcrumb">
|
||||
<ol itemscope itemtype="https://schema.org/BreadcrumbList">
|
||||
{% assign crumbs = page.url | split: '/' %}
|
||||
{% assign i = 1 %}
|
||||
{% for crumb in crumbs offset: 1 %}
|
||||
{% if forloop.first %}
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a href="{{ '/' | relative_url }}" itemprop="item"><span itemprop="name">{{ site.data.ui-text[locale].breadcrumb_home_label | default: "Home" }}</span></a>
|
||||
|
||||
<meta itemprop="position" content="{{ i }}" />
|
||||
</li>
|
||||
<span class="sep">{{ site.data.ui-text[locale].breadcrumb_separator | default: "/" }}</span>
|
||||
{% endif %}
|
||||
{% if forloop.last %}
|
||||
<li class="current"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>{{ page.title }}</li>
|
||||
{% else %}
|
||||
{% assign i = i | plus: 1 %}
|
||||
<li itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
|
||||
<a href="{{ crumb | downcase | replace: '%20', '-' | prepend: path_type | prepend: crumb_path | relative_url }}" itemprop="item"><span itemprop="name">{{ crumb | url_decode | replace: '-', ' ' | capitalize }}</span></a>
|
||||
<meta itemprop="position" content="{{ i }}" />
|
||||
</li>
|
||||
<span class="sep">{{ site.data.ui-text[locale].breadcrumb_separator | default: "/" }}</span>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</nav>
|
||||
@@ -0,0 +1,20 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% case site.category_archive.type %}
|
||||
{% when "liquid" %}
|
||||
{% assign path_type = "#" %}
|
||||
{% when "jekyll-archives" %}
|
||||
{% assign path_type = nil %}
|
||||
{% endcase %}
|
||||
|
||||
{% if site.category_archive.path %}
|
||||
{% assign categories_sorted = page.categories | sort_natural %}
|
||||
|
||||
<p class="page__taxonomy">
|
||||
<strong><i class="fas fa-fw fa-folder-open" aria-hidden="true"></i> {{ site.data.ui-text[locale].categories_label | default: "Categories:" }} </strong>
|
||||
<span itemprop="keywords">
|
||||
{% for category_word in categories_sorted %}
|
||||
<a href="{{ category_word | slugify | prepend: path_type | prepend: site.category_archive.path | relative_url }}" class="page__taxonomy-item p-category" rel="tag">{{ category_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,22 @@
|
||||
<article id="comment{{ include.index }}" class="js-comment comment" itemprop="comment" itemscope itemtype="https://schema.org/Comment">
|
||||
<div class="comment__avatar-wrapper">
|
||||
<img class="comment__avatar" src="https://www.gravatar.com/avatar/{{ include.email }}?d=mm&s=80" alt="{{ include.name }}">
|
||||
</div>
|
||||
<div class="comment__content-wrapper">
|
||||
<h3 class="comment__author" itemprop="author" itemscope itemtype="https://schema.org/Person">
|
||||
{% unless include.url == blank %}
|
||||
<span itemprop="name"><a rel="external nofollow" itemprop="url" href="{{ include.url }}">{{ include.name }}</a></span>
|
||||
{% else %}
|
||||
<span itemprop="name">{{ include.name }}</span>
|
||||
{% endunless %}
|
||||
</h3>
|
||||
<p class="comment__date">
|
||||
{% if include.date %}
|
||||
{% if include.index %}<a href="#comment{{ include.index }}" itemprop="url">{% endif %}
|
||||
<time datetime="{{ include.date | date_to_xmlschema }}" itemprop="datePublished">{{ include.date | date: "%B %-d, %Y at %I:%M %p" }}</time>
|
||||
{% if include.index %}</a>{% endif %}
|
||||
{% endif %}
|
||||
</p>
|
||||
<div itemprop="text">{{ include.message | markdownify }}</div>
|
||||
</div>
|
||||
</article>
|
||||
@@ -0,0 +1,3 @@
|
||||
<!-- start custom comments snippet -->
|
||||
|
||||
<!-- end custom comments snippet -->
|
||||
@@ -0,0 +1,3 @@
|
||||
<!-- start custom comments scripts -->
|
||||
|
||||
<!-- end custom comments scripts -->
|
||||
@@ -0,0 +1,13 @@
|
||||
{% if site.comments.discourse.server %}
|
||||
{% capture canonical %}{% if site.permalink contains '.html' %}{{ page.url | absolute_url }}{% else %}{{ page.url | absolute_url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
|
||||
<script type="text/javascript">
|
||||
DiscourseEmbed = { discourseUrl: '//{{ site.comments.discourse.server }}/',
|
||||
discourseEmbedUrl: '{{ canonical }}' };
|
||||
(function () {
|
||||
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
|
||||
d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
|
||||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
|
||||
})();
|
||||
</script>
|
||||
<noscript>Please enable JavaScript to view the comments powered by <a href="https://www.discourse.org/">Discourse.</a></noscript>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,15 @@
|
||||
{% if site.comments.disqus.shortname %}
|
||||
<script>
|
||||
var disqus_config = function () {
|
||||
this.page.url = "{{ page.url | absolute_url }}"; /* Replace PAGE_URL with your page's canonical URL variable */
|
||||
this.page.identifier = "{{ page.id }}"; /* Replace PAGE_IDENTIFIER with your page's unique identifier variable */
|
||||
};
|
||||
(function() { /* DON'T EDIT BELOW THIS LINE */
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
|
||||
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>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,8 @@
|
||||
<div id="fb-root"></div>
|
||||
<script>(function(d, s, id) {
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) return;
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5{% if site.comments.facebook.appid %}&appId={{ site.comments.facebook.appid }}{% endif %}";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));</script>
|
||||
@@ -0,0 +1,34 @@
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
var commentContainer = document.querySelector('#giscus-comments');
|
||||
|
||||
if (!commentContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
var script = document.createElement('script');
|
||||
|
||||
script.setAttribute('src', 'https://giscus.app/client.js');
|
||||
script.setAttribute('data-repo', '{{ site.repository | downcase }}');
|
||||
script.setAttribute('data-repo-id', '{{ site.comments.giscus.repo_id }}');
|
||||
script.setAttribute('data-category', '{{ site.comments.giscus.category_name }}');
|
||||
script.setAttribute('data-category-id', '{{ site.comments.giscus.category_id }}');
|
||||
script.setAttribute('data-mapping', '{{ site.comments.giscus.discussion_term | default: "pathname" }}');
|
||||
script.setAttribute('data-strict', '{{ site.comments.giscus.strict | default: 0 }}');
|
||||
script.setAttribute('data-reactions-enabled', '{{ site.comments.giscus.reactions_enabled | default: 1 }}');
|
||||
script.setAttribute('data-emit-metadata', '{{ site.comments.giscus.emit_metadata | default: 0 }}');
|
||||
script.setAttribute('data-input-position', '{{ site.comments.giscus.input_position | default: "top" }}');
|
||||
script.setAttribute('data-theme', '{{ site.comments.giscus.theme | default: "light" }}');
|
||||
script.setAttribute('data-lang', '{{ site.comments.giscus.lang | default: "en" }}');
|
||||
{% if site.comments.giscus.lazy %}
|
||||
script.setAttribute('data-loading', 'lazy');
|
||||
{% endif %}
|
||||
script.setAttribute('crossorigin', 'anonymous');
|
||||
|
||||
script.setAttribute('async', '');
|
||||
|
||||
commentContainer.appendChild(script);
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,21 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if site.comments.provider and page.comments %}
|
||||
{% case site.comments.provider %}
|
||||
{% when "disqus" %}
|
||||
{% include /comments-providers/disqus.html %}
|
||||
{% when "discourse" %}
|
||||
{% include /comments-providers/discourse.html %}
|
||||
{% when "facebook" %}
|
||||
{% include /comments-providers/facebook.html %}
|
||||
{% when "staticman" %}
|
||||
{% include /comments-providers/staticman.html locale=locale %}
|
||||
{% when "staticman_v2" %}
|
||||
{% include /comments-providers/staticman_v2.html locale=locale %}
|
||||
{% when "utterances" %}
|
||||
{% include /comments-providers/utterances.html %}
|
||||
{% when "giscus" %}
|
||||
{% include /comments-providers/giscus.html %}
|
||||
{% when "custom" %}
|
||||
{% include /comments-providers/custom_scripts.html %}
|
||||
{% endcase %}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,41 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if site.repository and site.staticman.branch %}
|
||||
<script>
|
||||
(function ($) {
|
||||
$('#new_comment').submit(function () {
|
||||
var form = this;
|
||||
|
||||
$(form).addClass('disabled');
|
||||
$('#comment-form-submit').html('<i class="fas fa-spinner fa-spin fa-fw"></i> {{ site.data.ui-text[locale].loading_label | default: "Loading..." }}');
|
||||
|
||||
$.ajax({
|
||||
type: $(this).attr('method'),
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
success: function (data) {
|
||||
$('#comment-form-submit').html('{{ site.data.ui-text[locale].comment_btn_submitted | default: "Submitted" }}');
|
||||
$('.page__comments-form .js-notice').removeClass('notice--danger');
|
||||
$('.page__comments-form .js-notice').addClass('notice--success');
|
||||
showAlert('{{ site.data.ui-text[locale].comment_success_msg | default: "Thanks for your comment! It will show on the site once it has been approved." }}');
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err);
|
||||
$('#comment-form-submit').html('{{ site.data.ui-text[locale].comment_btn_submit | default: "Submit Comment" }}');
|
||||
$('.page__comments-form .js-notice').removeClass('notice--success');
|
||||
$('.page__comments-form .js-notice').addClass('notice--danger');
|
||||
showAlert('{{ site.data.ui-text[locale].comment_error_msg | default: "Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again." }}');
|
||||
$(form).removeClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function showAlert(message) {
|
||||
$('.page__comments-form .js-notice').removeClass('hidden');
|
||||
$('.page__comments-form .js-notice-text').html(message);
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,41 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if site.repository and site.comments.staticman.branch %}
|
||||
<script>
|
||||
(function ($) {
|
||||
$('#new_comment').submit(function () {
|
||||
var form = this;
|
||||
|
||||
$(form).addClass('disabled');
|
||||
$('#comment-form-submit').html('<i class="fas fa-spinner fa-spin fa-fw"></i> {{ site.data.ui-text[locale].loading_label | default: "Loading..." }}');
|
||||
|
||||
$.ajax({
|
||||
type: $(this).attr('method'),
|
||||
url: $(this).attr('action'),
|
||||
data: $(this).serialize(),
|
||||
contentType: 'application/x-www-form-urlencoded',
|
||||
success: function (data) {
|
||||
$('#comment-form-submit').html('{{ site.data.ui-text[locale].comment_btn_submitted | default: "Submitted" }}');
|
||||
$('.page__comments-form .js-notice').removeClass('notice--danger');
|
||||
$('.page__comments-form .js-notice').addClass('notice--success');
|
||||
showAlert('{{ site.data.ui-text[locale].comment_success_msg | default: "Thanks for your comment! It will show on the site once it has been approved." }}');
|
||||
},
|
||||
error: function (err) {
|
||||
console.log(err);
|
||||
$('#comment-form-submit').html('{{ site.data.ui-text[locale].comment_btn_submit | default: "Submit Comment" }}');
|
||||
$('.page__comments-form .js-notice').removeClass('notice--success');
|
||||
$('.page__comments-form .js-notice').addClass('notice--danger');
|
||||
showAlert('{{ site.data.ui-text[locale].comment_error_msg | default: "Sorry, there was an error with your submission. Please make sure all required fields have been completed and try again." }}');
|
||||
$(form).removeClass('disabled');
|
||||
}
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
function showAlert(message) {
|
||||
$('.page__comments-form .js-notice').removeClass('hidden');
|
||||
$('.page__comments-form .js-notice-text').html(message);
|
||||
}
|
||||
})(jQuery);
|
||||
</script>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,21 @@
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
(function() {
|
||||
var commentContainer = document.querySelector('#utterances-comments');
|
||||
|
||||
if (!commentContainer) {
|
||||
return;
|
||||
}
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.setAttribute('src', 'https://utteranc.es/client.js');
|
||||
script.setAttribute('repo', '{{ site.repository }}');
|
||||
script.setAttribute('issue-term', '{{ site.comments.utterances.issue_term | default: "pathname" }}');
|
||||
{% if site.comments.utterances.label %}script.setAttribute('label', '{{ site.comments.utterances.label }}');{% endif %}
|
||||
script.setAttribute('theme', '{{ site.comments.utterances.theme | default: "github-light" }}');
|
||||
script.setAttribute('crossorigin', 'anonymous');
|
||||
|
||||
commentContainer.appendChild(script);
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,181 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<div class="page__comments">
|
||||
{% capture comments_label %}{{ site.data.ui-text[locale].comments_label | default: "Comments" }}{% endcapture %}
|
||||
{% case site.comments.provider %}
|
||||
{% when "discourse" %}
|
||||
<h4 class="page__comments-title">{{ comments_label }}</h4>
|
||||
<section id="discourse-comments"></section>
|
||||
{% when "disqus" %}
|
||||
<h4 class="page__comments-title">{{ comments_label }}</h4>
|
||||
<section id="disqus_thread"></section>
|
||||
{% when "facebook" %}
|
||||
<h4 class="page__comments-title">{{ comments_label }}</h4>
|
||||
<section class="fb-comments" data-href="{{ page.url | absolute_url }}" data-mobile="true" data-num-posts="{{ site.comments.facebook.num_posts | default: 5 }}" data-width="100%" data-colorscheme="{{ site.comments.facebook.colorscheme | default: 'light' }}"></section>
|
||||
{% when "staticman_v2" %}
|
||||
<section id="static-comments">
|
||||
{% if site.repository and site.comments.staticman.branch %}
|
||||
<!-- Start static comments -->
|
||||
<div class="js-comments">
|
||||
{% if site.data.comments[page.slug] %}
|
||||
<h4 class="page__comments-title">{{ site.data.ui-text[locale].comments_title | default: "Comments" }}</h4>
|
||||
{% assign comments = site.data.comments[page.slug] %}
|
||||
|
||||
<!-- In order to sort by date we must have an array of objects, not an array of arrays, so
|
||||
create a new array of plain comment objects and then sort by the comment date. -->
|
||||
{% assign commentObjects = '' | split: '' %}
|
||||
{% for comment in comments %}
|
||||
{% assign commentObject = comment[1] %}
|
||||
{% assign commentObjects = commentObjects | push: commentObject %}
|
||||
{% endfor %}
|
||||
{% assign comments = commentObjects | sort: "date" %}
|
||||
|
||||
{% for comment in comments %}
|
||||
{% assign email = comment.email %}
|
||||
{% assign name = comment.name %}
|
||||
{% assign url = comment.url %}
|
||||
{% assign date = comment.date %}
|
||||
{% assign message = comment.message %}
|
||||
{% include comment.html index=forloop.index email=email name=name url=url date=date message=message %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- End static comments -->
|
||||
|
||||
<!-- Start new comment form -->
|
||||
<div class="page__comments-form">
|
||||
<h4 class="page__comments-title">{{ site.data.ui-text[locale].comments_label | default: "Leave a Comment" }}</h4>
|
||||
<p class="small">{{ site.data.ui-text[locale].comment_form_info | default: "Your email address will not be published. Required fields are marked" }} <span class="required">*</span></p>
|
||||
<form id="new_comment" class="page__comments-form js-form form" method="post" action="{{ site.comments.staticman.endpoint }}{{ site.repository }}/{{ site.comments.staticman.branch }}/comments">
|
||||
<div class="form__spinner">
|
||||
<i class="fas fa-spinner fa-spin fa-3x fa-fw"></i>
|
||||
<span class="sr-only">{{ site.data.ui-text[locale].loading_label | default: "Loading..." }}</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="comment-form-message">{{ site.data.ui-text[locale].comment_form_comment_label | default: "Comment" }} <small class="required">*</small></label>
|
||||
<textarea type="text" rows="3" id="comment-form-message" name="fields[message]" tabindex="1"></textarea>
|
||||
<div class="small help-block"><a href="https://daringfireball.net/projects/markdown/">{{ site.data.ui-text[locale].comment_form_md_info | default: "Markdown is supported." }}</a></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment-form-name">{{ site.data.ui-text[locale].comment_form_name_label | default: "Name" }} <small class="required">*</small></label>
|
||||
<input type="text" id="comment-form-name" name="fields[name]" tabindex="2" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment-form-email">{{ site.data.ui-text[locale].comment_form_email_label | default: "Email address" }} <small class="required">*</small></label>
|
||||
<input type="email" id="comment-form-email" name="fields[email]" tabindex="3" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment-form-url">{{ site.data.ui-text[locale].comment_form_website_label | default: "Website (optional)" }}</label>
|
||||
<input type="url" id="comment-form-url" name="fields[url]" tabindex="4"/>
|
||||
</div>
|
||||
<div class="form-group hidden" style="display: none;">
|
||||
<input type="hidden" name="options[slug]" value="{{ page.slug }}">
|
||||
<label for="comment-form-location">Not used. Leave blank if you are a human.</label>
|
||||
<input type="text" id="comment-form-location" name="fields[hidden]" autocomplete="off"/>
|
||||
{% if site.reCaptcha.siteKey %}<input type="hidden" name="options[reCaptcha][siteKey]" value="{{ site.reCaptcha.siteKey }}">{% endif %}
|
||||
{% if site.reCaptcha.secret %}<input type="hidden" name="options[reCaptcha][secret]" value="{{ site.reCaptcha.secret }}">{% endif %}
|
||||
</div>
|
||||
<!-- Start comment form alert messaging -->
|
||||
<p class="hidden js-notice">
|
||||
<strong class="js-notice-text"></strong>
|
||||
</p>
|
||||
<!-- End comment form alert messaging -->
|
||||
{% if site.reCaptcha.siteKey %}
|
||||
<div class="form-group">
|
||||
<div class="g-recaptcha" data-sitekey="{{ site.reCaptcha.siteKey }}"></div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="form-group">
|
||||
<button type="submit" id="comment-form-submit" tabindex="5" class="btn btn--primary btn--large">{{ site.data.ui-text[locale].comment_btn_submit | default: "Submit Comment" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- End new comment form -->
|
||||
{% if site.reCaptcha.siteKey %}<script async src="https://www.google.com/recaptcha/api.js"></script>{% endif %}
|
||||
{% endif %}
|
||||
</section>
|
||||
{% when "staticman" %}
|
||||
<section id="static-comments">
|
||||
{% if site.repository and site.staticman.branch %}
|
||||
<!-- Start static comments -->
|
||||
<div class="js-comments">
|
||||
{% if site.data.comments[page.slug] %}
|
||||
<h4 class="page__comments-title">{{ site.data.ui-text[locale].comments_title | default: "Comments" }}</h4>
|
||||
{% assign comments = site.data.comments[page.slug] %}
|
||||
|
||||
<!-- In order to sort by date we must have an array of objects, not an array of arrays, so
|
||||
create a new array of plain comment objects and then sort by the comment date. -->
|
||||
{% assign commentObjects = '' | split: '' %}
|
||||
{% for comment in comments %}
|
||||
{% assign commentObject = comment[1] %}
|
||||
{% assign commentObjects = commentObjects | push: commentObject %}
|
||||
{% endfor %}
|
||||
{% assign comments = commentObjects | sort: "date" %}
|
||||
|
||||
{% for comment in comments %}
|
||||
{% assign email = comment.email %}
|
||||
{% assign name = comment.name %}
|
||||
{% assign url = comment.url %}
|
||||
{% assign date = comment.date %}
|
||||
{% assign message = comment.message %}
|
||||
{% include comment.html index=forloop.index email=email name=name url=url date=date message=message %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<!-- End static comments -->
|
||||
|
||||
<!-- Start new comment form -->
|
||||
<div class="page__comments-form">
|
||||
<h4 class="page__comments-title">{{ site.data.ui-text[locale].comments_label | default: "Leave a Comment" }}</h4>
|
||||
<p class="small">{{ site.data.ui-text[locale].comment_form_info | default: "Your email address will not be published. Required fields are marked" }} <span class="required">*</span></p>
|
||||
<form id="new_comment" class="page__comments-form js-form form" method="post" action="https://api.staticman.net/v1/entry/{{ site.repository }}/{{ site.staticman.branch }}">
|
||||
<div class="form__spinner">
|
||||
<i class="fas fa-spinner fa-spin fa-3x fa-fw"></i>
|
||||
<span class="sr-only">{{ site.data.ui-text[locale].loading_label | default: "Loading..." }}</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="comment-form-message">{{ site.data.ui-text[locale].comment_form_comment_label | default: "Comment" }} <small class="required">*</small></label>
|
||||
<textarea type="text" rows="3" id="comment-form-message" name="fields[message]" tabindex="1"></textarea>
|
||||
<div class="small help-block"><a href="https://daringfireball.net/projects/markdown/">{{ site.data.ui-text[locale].comment_form_md_info | default: "Markdown is supported." }}</a></div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment-form-name">{{ site.data.ui-text[locale].comment_form_name_label | default: "Name" }} <small class="required">*</small></label>
|
||||
<input type="text" id="comment-form-name" name="fields[name]" tabindex="2" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment-form-email">{{ site.data.ui-text[locale].comment_form_email_label | default: "Email address" }} <small class="required">*</small></label>
|
||||
<input type="email" id="comment-form-email" name="fields[email]" tabindex="3" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="comment-form-url">{{ site.data.ui-text[locale].comment_form_website_label | default: "Website (optional)" }}</label>
|
||||
<input type="url" id="comment-form-url" name="fields[url]" tabindex="4"/>
|
||||
</div>
|
||||
<div class="form-group hidden" style="display: none;">
|
||||
<input type="hidden" name="options[slug]" value="{{ page.slug }}">
|
||||
<label for="comment-form-location">Not used. Leave blank if you are a human.</label>
|
||||
<input type="text" id="comment-form-location" name="fields[hidden]" autocomplete="off"/>
|
||||
</div>
|
||||
<!-- Start comment form alert messaging -->
|
||||
<p class="hidden js-notice">
|
||||
<strong class="js-notice-text"></strong>
|
||||
</p>
|
||||
<!-- End comment form alert messaging -->
|
||||
<div class="form-group">
|
||||
<button type="submit" id="comment-form-submit" tabindex="5" class="btn btn--primary btn--large">{{ site.data.ui-text[locale].comment_btn_submit | default: "Submit Comment" }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<!-- End new comment form -->
|
||||
{% endif %}
|
||||
</section>
|
||||
{% when "utterances" %}
|
||||
<h4 class="page__comments-title">{{ comments_label }}</h4>
|
||||
<section id="utterances-comments"></section>
|
||||
{% when "giscus" %}
|
||||
<h4 class="page__comments-title">{{ comments_label }}</h4>
|
||||
<section id="giscus-comments"></section>
|
||||
{% when "custom" %}
|
||||
{% include /comments-providers/custom.html %}
|
||||
{% endcase %}
|
||||
</div>
|
||||
@@ -0,0 +1,7 @@
|
||||
<!--
|
||||
Minimal Mistakes Jekyll Theme 4.28.0 by Michael Rose
|
||||
Copyright 2013-2026 Michael Rose - mademistakes.com | @mmistakes
|
||||
Copyright 2024-2026 iBug - ibugone.com | @iBug
|
||||
Free for personal and commercial use under the MIT license
|
||||
https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
-->
|
||||
@@ -0,0 +1,7 @@
|
||||
/*!
|
||||
* Minimal Mistakes Jekyll Theme 4.28.0 by Michael Rose
|
||||
* Copyright 2013-2026 Michael Rose - mademistakes.com | @mmistakes
|
||||
* Copyright 2024-2026 iBug - ibugone.com | @iBug
|
||||
* Free for personal and commercial use under the MIT license
|
||||
* https://github.com/mmistakes/minimal-mistakes/blob/master/LICENSE
|
||||
*/
|
||||
@@ -0,0 +1,14 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign entries = include.entries | default: site[include.collection] | where_exp: "post", "post.hidden != true" %}
|
||||
|
||||
{% if include.sort_by %}
|
||||
{% assign entries = entries | sort: include.sort_by %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.sort_order == 'reverse' %}
|
||||
{% assign entries = entries | reverse %}
|
||||
{% endif %}
|
||||
|
||||
{%- for post in entries -%}
|
||||
{% include archive-single.html locale=locale type=include.type %}
|
||||
{%- endfor -%}
|
||||
@@ -0,0 +1,42 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if include.id %}
|
||||
{% assign feature_row = page[include.id] %}
|
||||
{% else %}
|
||||
{% assign feature_row = page.feature_row %}
|
||||
{% endif %}
|
||||
|
||||
<div class="feature__wrapper">
|
||||
|
||||
{% for f in feature_row %}
|
||||
<div class="feature__item{% if include.type %}--{{ include.type }}{% endif %}">
|
||||
<div class="archive__item">
|
||||
{% if f.image_path %}
|
||||
<div class="archive__item-teaser">
|
||||
<img src="{{ f.image_path | relative_url }}"
|
||||
alt="{% if f.alt %}{{ f.alt }}{% endif %}">
|
||||
{% if f.image_caption %}
|
||||
<span class="archive__item-caption">{{ f.image_caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="archive__item-body">
|
||||
{% if f.title %}
|
||||
<h2 class="archive__item-title">{{ f.title }}</h2>
|
||||
{% endif %}
|
||||
|
||||
{% if f.excerpt %}
|
||||
<div class="archive__item-excerpt">
|
||||
{{ f.excerpt | markdownify }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if f.url %}
|
||||
<p><a href="{{ f.url | relative_url }}" class="btn {{ f.btn_class }}">{{ f.btn_label | default: site.data.ui-text[locale].more_label | default: "Learn More" }}</a></p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
<figure class="{{ include.class }}">
|
||||
{%- if include.popup -%}<a href="{{ include.image_path | relative_url }}" class="image-popup"{% if include.caption %} title="{{ include.caption | markdownify | strip_html }}"{% endif %}>{%- endif -%}
|
||||
<img src="{{ include.image_path | relative_url }}"
|
||||
alt="{% if include.alt %}{{ include.alt | escape_once }}{% endif %}">
|
||||
{%- if include.popup -%}</a>{%- endif -%}
|
||||
{%- if include.caption -%}
|
||||
<figcaption>
|
||||
{{ include.caption | markdownify | remove: "<p>" | remove: "</p>" }}
|
||||
</figcaption>
|
||||
{%- endif -%}
|
||||
</figure>
|
||||
@@ -0,0 +1,27 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% unless site.atom_feed.hide %}
|
||||
{% assign show_atom = true %}
|
||||
{% endunless %}
|
||||
{% if site.footer.links or show_atom %}
|
||||
<div class="page__footer-follow">
|
||||
<ul class="social-icons">
|
||||
{% if site.data.ui-text[locale].follow_label %}
|
||||
<li><strong>{{ site.data.ui-text[locale].follow_label }}</strong></li>
|
||||
{% endif %}
|
||||
|
||||
{% if site.footer.links %}
|
||||
{% for link in site.footer.links %}
|
||||
{% if link.label and link.url %}
|
||||
<li><a href="{{ link.url }}" rel="nofollow noopener noreferrer{% if link.rel %} {{ link.rel }}{% endif %}"><i class="{{ link.icon | default: 'fas fa-link' }}" aria-hidden="true"></i> {{ link.label | escape_once | strip }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% unless site.atom_feed.hide %}
|
||||
<li><a href="{% if site.atom_feed.path %}{{ site.atom_feed.path }}{% else %}{{ '/feed.xml' | relative_url }}{% endif %}"><i class="fas fa-fw fa-square-rss" aria-hidden="true"></i> {{ site.data.ui-text[locale].feed_label | default: "Feed" }}</a></li>
|
||||
{% endunless %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="page__footer-copyright">© {% assign site_time = site.time | date: '%Y' %}{% if site.footer.since and site_time != site.footer.since %}{{ site.footer.since }} - {% endif %}{{ site_time }} <a href="{{ site.copyright_url | default: site.url }}">{{ site.copyright | default: site.title | escape_once | strip }}</a>. {{ site.data.ui-text[locale].powered_by | default: "Powered by" }} <a href="https://jekyllrb.com" rel="nofollow">Jekyll</a> & <a href="https://mademistakes.com/work/jekyll-themes/minimal-mistakes/" rel="nofollow">Minimal Mistakes</a>.</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<!-- start custom footer snippets -->
|
||||
|
||||
<!-- end custom footer snippets -->
|
||||
@@ -0,0 +1,35 @@
|
||||
{% if include.id %}
|
||||
{% assign gallery = page[include.id] %}
|
||||
{% else %}
|
||||
{% assign gallery = page.gallery %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.layout %}
|
||||
{% assign gallery_layout = include.layout %}
|
||||
{% else %}
|
||||
{% if gallery.size == 2 %}
|
||||
{% assign gallery_layout = 'half' %}
|
||||
{% elsif gallery.size >= 3 %}
|
||||
{% assign gallery_layout = 'third' %}
|
||||
{% else %}
|
||||
{% assign gallery_layout = '' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<figure class="{{ gallery_layout }} {{ include.class }}">
|
||||
{% for img in gallery %}
|
||||
{% if img.url %}
|
||||
<a href="{{ img.url | relative_url }}"
|
||||
{% if img.title %}title="{{ img.title | escape_once }}"{% endif %}>
|
||||
<img src="{{ img.image_path | relative_url }}"
|
||||
alt="{% if img.alt %}{{ img.alt | escape_once }}{% endif %}">
|
||||
</a>
|
||||
{% else %}
|
||||
<img src="{{ img.image_path | relative_url }}"
|
||||
alt="{% if img.alt %}{{ img.alt | escape_once }}{% endif %}">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if include.caption %}
|
||||
<figcaption>{{ include.caption | markdownify | remove: "<p>" | remove: "</p>" }}</figcaption>
|
||||
{% endif %}
|
||||
</figure>
|
||||
@@ -0,0 +1,47 @@
|
||||
<!--
|
||||
# Jekyll Group-By-Array 0.1.0
|
||||
# https://github.com/mushishi78/jekyll-group-by-array
|
||||
# © 2015 Max White <mushishi78@gmail.com>
|
||||
# MIT License
|
||||
-->
|
||||
|
||||
<!-- Initialize -->
|
||||
{% assign __empty_array = '' | split: ',' %}
|
||||
{% assign group_names = __empty_array %}
|
||||
{% assign group_items = __empty_array %}
|
||||
|
||||
<!-- Map -->
|
||||
{% assign __names = include.collection | map: include.field %}
|
||||
|
||||
<!-- Flatten -->
|
||||
{% assign __names = __names | join: ',' | join: ',' | split: ',' %}
|
||||
|
||||
<!-- Uniq -->
|
||||
{% assign __names = __names | sort %}
|
||||
{% for name in __names %}
|
||||
|
||||
<!-- If not equal to previous then it must be unique as sorted -->
|
||||
{% unless name == previous %}
|
||||
|
||||
<!-- Push to group_names -->
|
||||
{% assign group_names = group_names | push: name %}
|
||||
{% endunless %}
|
||||
|
||||
{% assign previous = name %}
|
||||
{% endfor %}
|
||||
|
||||
|
||||
<!-- group_items -->
|
||||
{% for name in group_names %}
|
||||
|
||||
<!-- Collect if contains -->
|
||||
{% assign __item = __empty_array %}
|
||||
{% for __element in include.collection %}
|
||||
{% if __element[include.field] contains name %}
|
||||
{% assign __item = __item | push: __element %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- Push to group_items -->
|
||||
{% assign group_items = group_items | push: __item %}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,29 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<meta charset="utf-8">
|
||||
|
||||
{% include seo.html locale=locale %}
|
||||
|
||||
{% unless site.atom_feed.hide %}
|
||||
<link href="{% if site.atom_feed.path %}{{ site.atom_feed.path }}{% else %}{{ '/feed.xml' | relative_url }}{% endif %}" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
|
||||
{% endunless %}
|
||||
|
||||
{%- comment %} https://docs.google.com/presentation/d/1rmxwWa9P6_xHqonmh5ONXRS-jPc5XKbnv99Rjkhe04s/present {% endcomment -%}
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<script>
|
||||
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/g, '') + ' js ';
|
||||
{% if site.enable_copy_code_button -%}
|
||||
window.enable_copy_code_button = true;
|
||||
{%- endif %}
|
||||
</script>
|
||||
|
||||
<!-- For all browsers -->
|
||||
<link rel="stylesheet" href="{{ '/assets/css/main.css' | relative_url }}">
|
||||
<link rel="preload" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
|
||||
<noscript><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@latest/css/all.min.css"></noscript>
|
||||
|
||||
{% if site.head_scripts %}
|
||||
{% for script in site.head_scripts %}
|
||||
<script src="{{ script | relative_url }}"></script>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,5 @@
|
||||
<!-- start custom head snippets -->
|
||||
|
||||
<!-- insert favicons. use https://realfavicongenerator.net/ -->
|
||||
|
||||
<!-- end custom head snippets -->
|
||||
@@ -0,0 +1,40 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% capture logo_path %}{{ site.logo }}{% endcapture %}
|
||||
|
||||
<div class="masthead">
|
||||
<div class="masthead__inner-wrap">
|
||||
<div class="masthead__menu">
|
||||
<nav id="site-nav" class="greedy-nav" aria-label="Primary navigation">
|
||||
{% unless logo_path == empty %}
|
||||
<a class="site-logo" href="{{ '/' | relative_url }}"><img src="{{ logo_path | relative_url }}" alt="{{ site.masthead_title | default: site.title }}"></a>
|
||||
{% endunless %}
|
||||
<a class="site-title" href="{{ '/' | relative_url }}">
|
||||
{{ site.masthead_title | default: site.title | escape_once | strip }}
|
||||
{% if site.subtitle %}<span class="site-subtitle">{{ site.subtitle | escape_once | strip }}</span>{% endif %}
|
||||
</a>
|
||||
<ul class="visible-links">
|
||||
{%- for link in site.data.navigation.main -%}
|
||||
<li class="masthead__menu-item">
|
||||
<a
|
||||
href="{{ link.url | relative_url }}"
|
||||
{% if link.description %} title="{{ link.description }}"{% endif %}
|
||||
{% if link.target %} target="{{ link.target }}"{% endif %}
|
||||
>{{ link.title }}</a>
|
||||
</li>
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
{% if site.search == true %}
|
||||
<button class="search__toggle" type="button">
|
||||
<span class="visually-hidden">{{ site.data.ui-text[locale].search_label | default: "Toggle search" }}</span>
|
||||
<i class="fas fa-search"></i>
|
||||
</button>
|
||||
{% endif %}
|
||||
<button class="greedy-nav__toggle hidden" type="button">
|
||||
<span class="visually-hidden">{{ site.data.ui-text[locale].menu_label | default: "Toggle menu" }}</span>
|
||||
<div class="navicon"></div>
|
||||
</button>
|
||||
<ul class="hidden-links hidden"></ul>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<nav class="nav__list">
|
||||
{% if page.sidebar.title %}<h3 class="nav__title" style="padding-left: 0;">{{ page.sidebar.title }}</h3>{% endif %}
|
||||
<input id="ac-toc" name="accordion-toc" type="checkbox" />
|
||||
<label for="ac-toc">{{ site.data.ui-text[locale].menu_label | default: "Toggle Menu" }}</label>
|
||||
<ul class="nav__items">
|
||||
{% for navname in include.nav %}
|
||||
{% assign navigation = site.data.navigation[navname] %}
|
||||
{% for nav in navigation %}
|
||||
<li>
|
||||
{% if nav.url %}
|
||||
<a href="{{ nav.url | relative_url }}"><span class="nav__sub-title">{{ nav.title }}</span></a>
|
||||
{% else %}
|
||||
<span class="nav__sub-title">{{ nav.title }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if nav.children != null %}
|
||||
<ul>
|
||||
{% for child in nav.children %}
|
||||
<li><a href="{{ child.url | relative_url }}"{% if child.url == page.url %} class="active"{% endif %}>{{ child.title }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -0,0 +1,7 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign date_format = site.date_format | default: "%B %-d, %Y" %}
|
||||
{% if page.last_modified_at %}
|
||||
<p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> {{ site.data.ui-text[locale].date_label | default: "Updated:" }}</strong> <time class="dt-updated" datetime="{{ page.last_modified_at | date: "%Y-%m-%d" }}">{{ page.last_modified_at | date: date_format }}</time></p>
|
||||
{% elsif page.date %}
|
||||
<p class="page__date"><strong><i class="fas fa-fw fa-calendar-alt" aria-hidden="true"></i> {{ site.data.ui-text[locale].date_label | default: "Updated:" }}</strong> <time class="dt-published" datetime="{{ page.date | date_to_xmlschema }}">{{ page.date | date: date_format }}</time></p>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,54 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% capture overlay_img_path %}{{ page.header.overlay_image | relative_url }}{% endcapture %}
|
||||
|
||||
{% if page.header.overlay_filter contains "gradient" %}
|
||||
{% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %}
|
||||
{% elsif page.header.overlay_filter contains "rgba" %}
|
||||
{% capture overlay_filter %}{{ page.header.overlay_filter }}{% endcapture %}
|
||||
{% capture overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}){% endcapture %}
|
||||
{% elsif page.header.overlay_filter %}
|
||||
{% capture overlay_filter %}rgba(0, 0, 0, {{ page.header.overlay_filter }}){% endcapture %}
|
||||
{% capture overlay_filter %}linear-gradient({{ overlay_filter }}, {{ overlay_filter }}){% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.header.image_description %}
|
||||
{% assign image_description = page.header.image_description %}
|
||||
{% else %}
|
||||
{% assign image_description = page.title %}
|
||||
{% endif %}
|
||||
|
||||
{% assign image_description = image_description | markdownify | strip_html | strip_newlines | escape_once %}
|
||||
|
||||
<div class="page__hero{% if page.header.overlay_color or page.header.overlay_image %}--overlay{% endif %}"
|
||||
style="{% if page.header.overlay_color %}background-color: {{ page.header.overlay_color | default: 'transparent' }};{% endif %} {% if overlay_img_path %}background-image: {% if overlay_filter %}{{ overlay_filter }}, {% endif %}url('{{ overlay_img_path }}');{% endif %}"
|
||||
>
|
||||
{% if page.header.overlay_color or page.header.overlay_image %}
|
||||
<div class="wrapper">
|
||||
<h1 id="page-title" class="page__title" itemprop="headline">
|
||||
{% if paginator and site.paginate_show_page_num %}
|
||||
{{ site.title }}{% unless paginator.page == 1 %} {{ site.data.ui-text[locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}
|
||||
{% else %}
|
||||
{{ page.title | default: site.title | markdownify | remove: "<p>" | remove: "</p>" }}
|
||||
{% endif %}
|
||||
</h1>
|
||||
{% if page.tagline %}
|
||||
<p class="page__lead">{{ page.tagline | markdownify | remove: "<p>" | remove: "</p>" }}</p>
|
||||
{% elsif page.header.show_overlay_excerpt != false and page.excerpt %}
|
||||
<p class="page__lead">{{ page.excerpt | markdownify | remove: "<p>" | remove: "</p>" }}</p>
|
||||
{% endif %}
|
||||
{% include page__meta.html locale=locale %}
|
||||
{% if page.header.actions %}
|
||||
<p>
|
||||
{% for action in page.header.actions %}
|
||||
<a href="{{ action.url | relative_url }}" class="btn btn--light-outline btn--large">{{ action.label | default: site.data.ui-text[locale].more_label | default: "Learn More" }}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% else %}
|
||||
<img src="{{ page.header.image | relative_url }}" alt="{{ image_description }}" class="page__hero-image">
|
||||
{% endif %}
|
||||
{% if page.header.caption %}
|
||||
<span class="page__hero-caption">{{ page.header.caption | markdownify | remove: "<p>" | remove: "</p>" }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -0,0 +1,2 @@
|
||||
{% assign video = page.header.video %}
|
||||
{% include video id=video.id provider=video.provider danmaku=video.danmaku %}
|
||||
@@ -0,0 +1,32 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign document = post | default: page %}
|
||||
{% if document.read_time or document.show_date %}
|
||||
<p class="page__meta">
|
||||
{% if document.show_date and document.date %}
|
||||
{% assign date = document.date %}
|
||||
<span class="page__meta-date">
|
||||
<i class="far {% if include.type == 'grid' and document.read_time and document.show_date %}fa-fw {% endif %}fa-calendar-alt" aria-hidden="true"></i>
|
||||
{% assign date_format = site.date_format | default: "%B %-d, %Y" %}
|
||||
<time datetime="{{ date | date_to_xmlschema }}">{{ date | date: date_format }}</time>
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{% if document.read_time and document.show_date %}<span class="page__meta-sep"></span>{% endif %}
|
||||
|
||||
{% if document.read_time %}
|
||||
{% assign words_per_minute = document.words_per_minute | default: site.words_per_minute | default: 200 %}
|
||||
{% assign words = document.content | strip_html | number_of_words %}
|
||||
|
||||
<span class="page__meta-readtime">
|
||||
<i class="far {% if include.type == 'grid' and document.read_time and document.show_date %}fa-fw {% endif %}fa-clock" aria-hidden="true"></i>
|
||||
{% if words < words_per_minute %}
|
||||
{{ site.data.ui-text[locale].less_than | default: "less than" }} 1 {{ site.data.ui-text[locale].minute_read | default: "minute read" }}
|
||||
{% elsif words == words_per_minute %}
|
||||
1 {{ site.data.ui-text[locale].minute_read | default: "minute read" }}
|
||||
{% else %}
|
||||
{{ words | divided_by: words_per_minute }} {{ site.data.ui-text[locale].minute_read | default: "minute read" }}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,12 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign posts = include.posts | where_exp: "post", "post.hidden != true" %}
|
||||
<div class="page__related">
|
||||
{% include before-related.html %}
|
||||
<h2 class="page__related-title">{{ site.data.ui-text[locale].related_label | default: "You May Also Enjoy" }}</h2>
|
||||
<div class="grid__wrapper">
|
||||
{% for post in posts limit:4 %}
|
||||
{% if post.id == page.id %}{% continue %}{% endif %}
|
||||
{% include archive-single.html locale=locale type="grid" %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% unless site.show_taxonomy == false %}
|
||||
{% if site.tag_archive.type and page.tags[0] %}
|
||||
{% include tag-list.html locale=locale %}
|
||||
{% endif %}
|
||||
|
||||
{% if site.category_archive.type and page.categories[0] %}
|
||||
{% include category-list.html locale=locale %}
|
||||
{% endif %}
|
||||
{% endunless %}
|
||||
@@ -0,0 +1,71 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if paginator.total_pages > 1 %}
|
||||
<nav class="pagination" aria-label="Pagination">
|
||||
{% assign paginate_path_last = site.paginate_path | split: '/' | last %}
|
||||
{% assign first_page_path = paginator.first_page_path | default: site.paginate_path | replace: paginate_path_last, '' | replace: '//', '/' | relative_url %}
|
||||
<ul>
|
||||
{% comment %} Link for previous page {% endcomment %}
|
||||
{% if paginator.previous_page %}
|
||||
{% if paginator.previous_page == 1 %}
|
||||
<li><a href="{{ first_page_path }}">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.previous_page | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</a></li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</span></a></li>
|
||||
{% endif %}
|
||||
|
||||
{% comment %} First page {% endcomment %}
|
||||
{% if paginator.page == 1 %}
|
||||
<li><a href="#" class="disabled current">1</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ first_page_path }}">1</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% assign page_start = 2 %}
|
||||
{% if paginator.page > 4 %}
|
||||
{% assign page_start = paginator.page | minus: 2 %}
|
||||
{% comment %} Ellipsis for truncated links {% endcomment %}
|
||||
<li><a href="#" class="disabled">…</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% assign page_end = paginator.total_pages | minus: 1 %}
|
||||
{% assign pages_to_end = paginator.total_pages | minus: paginator.page %}
|
||||
{% if pages_to_end > 4 %}
|
||||
{% assign page_end = paginator.page | plus: 2 %}
|
||||
{% endif %}
|
||||
|
||||
{% for index in (page_start..page_end) %}
|
||||
{% if index == paginator.page %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', index | replace: '//', '/' | relative_url }}" class="disabled current">{{ index }}</a></li>
|
||||
{% else %}
|
||||
{% comment %} Distance from current page and this link {% endcomment %}
|
||||
{% assign dist = paginator.page | minus: index %}
|
||||
{% if dist < 0 %}
|
||||
{% comment %} Distance must be a positive value {% endcomment %}
|
||||
{% assign dist = 0 | minus: dist %}
|
||||
{% endif %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', index | relative_url }}">{{ index }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% comment %} Ellipsis for truncated links {% endcomment %}
|
||||
{% if pages_to_end > 3 %}
|
||||
<li><a href="#" class="disabled">…</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if paginator.page == paginator.total_pages %}
|
||||
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.total_pages | replace: '//', '/' | relative_url }}">{{ paginator.total_pages }}</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% comment %} Link next page {% endcomment %}
|
||||
{% if paginator.next_page %}
|
||||
<li><a href="{{ site.paginate_path | replace: ':num', paginator.next_page | replace: '//', '/' | relative_url }}">{{ site.data.ui-text[locale].pagination_next | default: "Next" }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[locale].pagination_next | default: "Next" }}</span></a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,69 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<nav class="pagination" aria-label="Pagination">
|
||||
<ul>
|
||||
{% comment %} Link for previous page {% endcomment %}
|
||||
{% if paginator.previous_page %}
|
||||
{% if paginator.previous_page == 1 %}
|
||||
<li><a href="{{ paginator.first_page_path | relative_url }}">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ paginator.previous_page_path | relative_url }}">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</a></li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</span></a></li>
|
||||
{% endif %}
|
||||
|
||||
{% comment %} Determine whether the first page and the last page are already included in trail {% endcomment %}
|
||||
{% for trail in paginator.page_trail %}
|
||||
{% if trail.num == paginator.first_page %}
|
||||
{% assign has_first_page = true %}
|
||||
{% elsif trail.num == paginator.last_page %}
|
||||
{% assign has_last_page = true %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% comment %} First page {% endcomment %}
|
||||
{% unless has_first_page %}
|
||||
{% if paginator.page == 1 %}
|
||||
<li><a href="#" class="disabled current">1</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ paginator.first_page_path | relative_url }}">1</a></li>
|
||||
{% endif %}
|
||||
{% endunless %}
|
||||
|
||||
{% comment %} Ellipsis for truncated links {% endcomment %}
|
||||
{% assign ellipsis_start = paginator.first_page | plus: 1 %}
|
||||
{% if paginator.page_trail.first.num > ellipsis_start %}
|
||||
<li><a href="#" class="disabled">…</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% comment %} Main pagination trail {% endcomment %}
|
||||
{% for trail in paginator.page_trail %}
|
||||
{% if paginator.page == trail.num %}
|
||||
<li><a href="{{ trail.path | remove: 'index.html' | relative_url }}" class="disabled current">{{ trail.num }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ trail.path | remove: 'index.html' | relative_url }}">{{ trail.num }}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% comment %} Ellipsis for truncated links {% endcomment %}
|
||||
{% assign ellipsis_end = paginator.last_page | minus: 1 %}
|
||||
{% if paginator.page_trail.last.num < ellipsis_end %}
|
||||
<li><a href="#" class="disabled">…</a></li>
|
||||
{% endif %}
|
||||
|
||||
{% unless has_last_page %}
|
||||
{% if paginator.page == paginator.total_pages %}
|
||||
<li><a href="#" class="disabled current">{{ paginator.page }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="{{ paginator.last_page_path | remove: 'index.html' | relative_url }}">{{ paginator.total_pages }}</a></li>
|
||||
{% endif %}
|
||||
{% endunless %}
|
||||
|
||||
{% comment %} Link next page {% endcomment %}
|
||||
{% if paginator.next_page %}
|
||||
<li><a href="{{ paginator.next_page_path | remove: 'index.html' | relative_url }}">{{ site.data.ui-text[locale].pagination_next | default: "Next" }}</a></li>
|
||||
{% else %}
|
||||
<li><a href="#" class="disabled"><span aria-hidden="true">{{ site.data.ui-text[locale].pagination_next | default: "Next" }}</span></a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -0,0 +1,8 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if paginator.total_pages > 1 %}
|
||||
{% if site.paginate %}
|
||||
{% include paginator-v1.html locale=locale %}
|
||||
{% elsif site.pagination.enabled %}
|
||||
{% include paginator-v2.html locale=locale %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,15 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if page.previous or page.next %}
|
||||
<nav class="pagination" aria-label="Post pagination">
|
||||
{% if page.previous %}
|
||||
<a href="{{ page.previous.url | relative_url }}" class="pagination--pager" title="{{ page.previous.title | markdownify | strip_html | strip}}">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</a>
|
||||
{% else %}
|
||||
<a href="#" class="pagination--pager disabled">{{ site.data.ui-text[locale].pagination_previous | default: "Previous" }}</a>
|
||||
{% endif %}
|
||||
{% if page.next %}
|
||||
<a href="{{ page.next.url | relative_url }}" class="pagination--pager" title="{{ page.next.title | markdownify | strip_html | strip}}">{{ site.data.ui-text[locale].pagination_next | default: "Next" }}</a>
|
||||
{% else %}
|
||||
<a href="#" class="pagination--pager disabled">{{ site.data.ui-text[locale].pagination_next | default: "Next" }}</a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,5 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign posts = site.categories[include.taxonomy] | where_exp: "post", "post.hidden != true" %}
|
||||
{%- for post in posts -%}
|
||||
{% include archive-single.html locale=locale %}
|
||||
{%- endfor -%}
|
||||
@@ -0,0 +1,5 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign posts = site.tags[include.taxonomy] | where_exp: "post", "post.hidden != true" %}
|
||||
{%- for post in posts -%}
|
||||
{% include archive-single.html locale=locale %}
|
||||
{%- endfor -%}
|
||||
@@ -0,0 +1,38 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign items_max = 0 %}
|
||||
{% for item in include.taxonomies %}
|
||||
{% if item[1].size > items_max %}
|
||||
{% assign items_max = item[1].size %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<ul class="taxonomy__index">
|
||||
{% for i in (1..items_max) reversed %}
|
||||
{% for item in include.taxonomies %}
|
||||
{% if item[1].size == i %}
|
||||
<li>
|
||||
<a href="#{{ item[0] | slugify }}">
|
||||
<strong>{{ item[0] }}</strong> <span class="taxonomy__count">{{ i }}</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% assign entries_layout = page.entries_layout | default: 'list' %}
|
||||
{% for i in (1..items_max) reversed %}
|
||||
{% for taxonomy in include.taxonomies %}
|
||||
{% if taxonomy[1].size == i %}
|
||||
<section id="{{ taxonomy[0] | slugify }}" class="taxonomy__section">
|
||||
<h2 class="archive__subtitle">{{ taxonomy[0] }}</h2>
|
||||
<div class="entries-{{ entries_layout }}">
|
||||
{% for post in taxonomy.last %}
|
||||
{% include archive-single.html locale=locale type=entries_layout %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
<a href="#page-title" class="back-to-top">{{ site.data.ui-text[locale].back_to_top | default: 'Back to Top' }} ↑</a>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@@ -0,0 +1,16 @@
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
{% if site.social.type == "Organization" -%}
|
||||
"@type": "Organization",
|
||||
"url": {{ '/' | absolute_url | jsonify }}{% if site.og_image %},
|
||||
"logo": {{ site_og_image | jsonify }}{% endif %}{% if site.social.links %},
|
||||
"sameAs": {{ site.social.links | jsonify }}{% endif %}
|
||||
{%- else -%}
|
||||
"@type": "Person",
|
||||
"name": {{ site.social.name | default: site.name | jsonify }},
|
||||
"url": {{ '/' | absolute_url | jsonify }}{% if site.social.links %},
|
||||
"sameAs": {{ site.social.links | jsonify }}{% endif %}
|
||||
{%- endif %}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,29 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if site.footer_scripts %}
|
||||
{% for script in site.footer_scripts %}
|
||||
<script src="{{ script | relative_url }}"></script>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<script src="{{ '/assets/js/main.min.js' | relative_url }}"></script>
|
||||
{% endif %}
|
||||
|
||||
{% if site.search == true or page.layout == "search" %}
|
||||
{%- assign search_provider = site.search_provider | default: "lunr" -%}
|
||||
{%- case search_provider -%}
|
||||
{%- when "lunr" -%}
|
||||
{% include_cached search/lunr-search-scripts.html locale=locale %}
|
||||
{%- when "google" -%}
|
||||
{% include_cached search/google-search-scripts.html %}
|
||||
{%- when "algolia" -%}
|
||||
{% include_cached search/algolia-search-scripts.html locale=locale %}
|
||||
{%- endcase -%}
|
||||
{% endif %}
|
||||
|
||||
{% include analytics.html %}
|
||||
{% include /comments-providers/scripts.html locale=locale %}
|
||||
|
||||
{% if site.after_footer_scripts %}
|
||||
{% for script in site.after_footer_scripts %}
|
||||
<script src="{{ script | relative_url }}"></script>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,83 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<script>
|
||||
// Including InstantSearch.js library and styling
|
||||
const loadSearch = function() {
|
||||
const loadCSS = function(src) {
|
||||
var link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.type = 'text/css';
|
||||
link.href = src;
|
||||
link.media = 'all';
|
||||
document.head.appendChild(link);
|
||||
};
|
||||
|
||||
var script = document.createElement('script');
|
||||
script.setAttribute("type", "text/javascript");
|
||||
script.setAttribute("src", "https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch.min.js");
|
||||
script.addEventListener("load", function() {
|
||||
// Instantiating InstantSearch.js with Algolia credentials
|
||||
const search = instantsearch({
|
||||
appId: '{{ site.algolia.application_id }}',
|
||||
apiKey: '{{ site.algolia.search_only_api_key }}',
|
||||
indexName: '{{ site.algolia.index_name }}',
|
||||
searchParameters: {
|
||||
restrictSearchableAttributes: ['title', 'content']
|
||||
}
|
||||
});
|
||||
|
||||
const hitTemplate = function(hit) {
|
||||
const url = hit.url;
|
||||
const hightlight = hit._highlightResult;
|
||||
const title = hightlight.title && hightlight.title.value || "";
|
||||
const content = hightlight.html && hightlight.html.value || "";
|
||||
|
||||
return `
|
||||
<div class="list__item">
|
||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||
<h2 class="archive__item-title" itemprop="headline"><a href="{{ site.baseurl }}${url}">${title}</a></h2>
|
||||
<div class="archive__item-excerpt" itemprop="description">${content}</div>
|
||||
</article>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
// Adding searchbar and results widgets
|
||||
search.addWidget(
|
||||
instantsearch.widgets.searchBox({
|
||||
container: '.search-searchbar',
|
||||
{% unless site.algolia.powered_by == false %}poweredBy: true,{% endunless %}
|
||||
placeholder: '{{ site.data.ui-text[locale].search_placeholder_text | default: "Enter your search term..." }}'
|
||||
})
|
||||
);
|
||||
search.addWidget(
|
||||
instantsearch.widgets.hits({
|
||||
container: '.search-hits',
|
||||
templates: {
|
||||
item: hitTemplate,
|
||||
empty: '{{ site.data.ui-text[locale].search_algolia_no_results | default: "No results" }}',
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
if (!search.started) {
|
||||
search.start();
|
||||
}
|
||||
});
|
||||
document.body.appendChild(script);
|
||||
|
||||
loadCSS("https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch.min.css");
|
||||
loadCSS("https://cdn.jsdelivr.net/npm/instantsearch.js@2.3.3/dist/instantsearch-theme-algolia.min.css");
|
||||
};
|
||||
|
||||
// Starting the search only when toggle is clicked
|
||||
$(document).ready(function() {
|
||||
var scriptLoaded = false;
|
||||
|
||||
$(".search__toggle").on("click", function() {
|
||||
if (!scriptLoaded) {
|
||||
loadSearch();
|
||||
scriptLoaded = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,30 @@
|
||||
<script>
|
||||
(function () {
|
||||
var cx = '{{ site.google.search_engine_id }}';
|
||||
var gcse = document.createElement('script');
|
||||
gcse.type = 'text/javascript';
|
||||
gcse.async = true;
|
||||
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx;
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
s.parentNode.insertBefore(gcse, s);
|
||||
})();
|
||||
|
||||
function googleCustomSearchExecute() {
|
||||
var input = document.getElementById('cse-search-input-box-id');
|
||||
var element = google.search.cse.element.getElement('searchresults-only0');
|
||||
if (input.value == '') {
|
||||
element.clearAllResults();
|
||||
} else {
|
||||
element.execute(input.value);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
{% if site.google.instant_search %}
|
||||
$(document).ready(function () {
|
||||
$('input#cse-search-input-box-id').on('keyup', function () {
|
||||
googleCustomSearchExecute();
|
||||
});
|
||||
});
|
||||
{% endif %}
|
||||
</script>
|
||||
@@ -0,0 +1,11 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% assign lang = locale | slice: 0,2 | default: "en" %}
|
||||
{% case lang %}
|
||||
{% when "gr" %}
|
||||
{% assign lang = "gr" %}
|
||||
{% else %}
|
||||
{% assign lang = "en" %}
|
||||
{% endcase %}
|
||||
<script src="{{ '/assets/js/lunr/lunr.min.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/lunr/lunr-store.js' | relative_url }}"></script>
|
||||
<script src="{{ '/assets/js/lunr/lunr-' | append: lang | append: '.js' | relative_url }}"></script>
|
||||
@@ -0,0 +1,27 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<div class="search-content__inner-wrap">
|
||||
{%- assign search_provider = site.search_provider | default: "lunr" -%}
|
||||
{%- case search_provider -%}
|
||||
{%- when "lunr" -%}
|
||||
<form class="search-content__form" onkeydown="return event.key != 'Enter';" role="search">
|
||||
<label class="sr-only" for="search">
|
||||
{{ site.data.ui-text[locale].search_label_text | default: 'Enter your search term...' }}
|
||||
</label>
|
||||
<input type="search" id="search" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
||||
</form>
|
||||
<div id="results" class="results"></div>
|
||||
{%- when "google" -%}
|
||||
<form onsubmit="return googleCustomSearchExecute();" id="cse-search-box-form-id" role="search">
|
||||
<label class="sr-only" for="cse-search-input-box-id">
|
||||
{{ site.data.ui-text[locale].search_label_text | default: 'Enter your search term...' }}
|
||||
</label>
|
||||
<input type="search" id="cse-search-input-box-id" class="search-input" tabindex="-1" placeholder="{{ site.data.ui-text[locale].search_placeholder_text | default: 'Enter your search term...' }}" />
|
||||
</form>
|
||||
<div id="results" class="results">
|
||||
<gcse:searchresults-only></gcse:searchresults-only>
|
||||
</div>
|
||||
{%- when "algolia" -%}
|
||||
<div class="search-searchbar"></div>
|
||||
<div class="search-hits"></div>
|
||||
{%- endcase -%}
|
||||
</div>
|
||||
@@ -0,0 +1,152 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<!-- begin _includes/seo.html -->
|
||||
{%- assign title_separator = site.title_separator | default: '-' -%}
|
||||
|
||||
{%- assign page_title = page.title | default: site.title | replace: '|', '|' -%}
|
||||
{%- if page_title contains site.title -%}
|
||||
{%- assign seo_title = page_title | replace: '|', '|' -%}
|
||||
{%- else -%}
|
||||
{%- assign seo_title = page_title | append: " " | append: title_separator | append: " " | append: site.title | replace: '|', '|' -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- assign page_title = page_title | markdownify | strip_html | strip_newlines | escape_once -%}
|
||||
{%- assign seo_title = seo_title | markdownify | strip_html | strip_newlines | escape_once -%}
|
||||
|
||||
{%- assign canonical_url = page.canonical_url | default: page.url | replace: "/index.html", "/" | absolute_url %}
|
||||
|
||||
{%- assign seo_description = page.description | default: page.excerpt | default: site.description -%}
|
||||
{%- if seo_description -%}
|
||||
{%- assign seo_description = seo_description | markdownify | strip_html | newline_to_br | strip_newlines | replace: '<br />', ' ' | escape_once | strip -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- assign author = page.author | default: page.authors[0] | default: site.author -%}
|
||||
{%- assign author = site.data.authors[author] | default: author -%}
|
||||
|
||||
{%- if author.twitter -%}
|
||||
{%- assign author_twitter = author.twitter | replace: "@", "" -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- assign page_large_image = page.header.og_image | default: page.header.overlay_image | default: page.header.image | absolute_url | escape -%}
|
||||
{%- assign page_teaser_image = page.header.teaser | default: site.og_image | absolute_url | escape -%}
|
||||
{%- assign site_og_image = site.og_image | absolute_url | escape -%}
|
||||
{%- assign og_image_alt = page.header.og_image_alt | default: site.og_image_alt | escape -%}
|
||||
|
||||
{%- if page.date -%}
|
||||
{%- assign og_type = "article" -%}
|
||||
{%- else -%}
|
||||
{%- assign og_type = "website" -%}
|
||||
{%- endif -%}
|
||||
|
||||
<title>{{ seo_title }}{% if paginator %}{% unless paginator.page == 1 %} {{ title_separator }} {{ site.data.ui-text[locale].page | default: "Page" }} {{ paginator.page }}{% endunless %}{% endif %}</title>
|
||||
<meta name="description" content="{{ seo_description }}">
|
||||
|
||||
{% if author.name %}
|
||||
<meta name="author" content="{{ author.name | default: author | escape_once | strip }}">
|
||||
{% if og_type == "article" %}
|
||||
<meta property="article:author" content="{{ author.name | default: author | escape_once | strip }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<meta property="og:type" content="{{ og_type }}">
|
||||
<meta property="og:locale" content="{{ locale | replace: "-", "_" | default: "en_US" }}">
|
||||
<meta property="og:site_name" content="{{ site.title | escape_once | strip }}">
|
||||
<meta property="og:title" content="{{ page_title }}">
|
||||
<meta property="og:url" content="{{ canonical_url }}">
|
||||
|
||||
{% if seo_description %}
|
||||
<meta property="og:description" content="{{ seo_description }}">
|
||||
{% endif %}
|
||||
|
||||
{% if page_large_image %}
|
||||
<meta property="og:image" content="{{ page_large_image }}">
|
||||
{% if og_image_alt %}
|
||||
<meta property="og:image:alt" content="{{ og_image_alt }}">
|
||||
{% endif %}
|
||||
{% elsif page_teaser_image %}
|
||||
<meta property="og:image" content="{{ page_teaser_image }}">
|
||||
{% if og_image_alt %}
|
||||
<meta property="og:image:alt" content="{{ og_image_alt }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if site.twitter.username %}
|
||||
<meta name="twitter:site" content="@{{ site.twitter.username | replace: "@", "" }}">
|
||||
<meta name="twitter:title" content="{{ page_title }}">
|
||||
<meta name="twitter:description" content="{{ seo_description }}">
|
||||
<meta name="twitter:url" content="{{ canonical_url }}">
|
||||
|
||||
{% if page_large_image %}
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="{{ page_large_image }}">
|
||||
{% if og_image_alt %}
|
||||
<meta name="twitter:image:alt" content="{{ og_image_alt }}">
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<meta name="twitter:card" content="summary">
|
||||
{% if page_teaser_image %}
|
||||
<meta name="twitter:image" content="{{ page_teaser_image }}">
|
||||
{% if og_image_alt %}
|
||||
<meta name="twitter:image:alt" content="{{ og_image_alt }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if author_twitter %}
|
||||
<meta name="twitter:creator" content="@{{ author_twitter }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if author.fediverse %}
|
||||
<meta name="fediverse:creator" content="{{ author.fediverse }}">
|
||||
{% endif %}
|
||||
|
||||
{% if page.date %}
|
||||
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
|
||||
{% endif %}
|
||||
|
||||
{% if og_type == "article" and page.last_modified_at %}
|
||||
<meta property="article:modified_time" content="{{ page.last_modified_at | date_to_xmlschema }}">
|
||||
{% endif %}
|
||||
|
||||
{% if site.facebook %}
|
||||
{% if site.facebook.publisher %}
|
||||
<meta property="article:publisher" content="{{ site.facebook.publisher }}">
|
||||
{% endif %}
|
||||
|
||||
{% if site.facebook.app_id %}
|
||||
<meta property="fb:app_id" content="{{ site.facebook.app_id }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<link rel="canonical" href="{{ canonical_url }}">
|
||||
|
||||
{% if paginator.previous_page %}
|
||||
<link rel="prev" href="{{ paginator.previous_page_path | absolute_url }}">
|
||||
{% endif %}
|
||||
{% if paginator.next_page %}
|
||||
<link rel="next" href="{{ paginator.next_page_path | absolute_url }}">
|
||||
{% endif %}
|
||||
|
||||
{% if page.url == '/' %}
|
||||
{% include schema.html %}
|
||||
{% endif %}
|
||||
|
||||
{% if site.google_site_verification %}
|
||||
<meta name="google-site-verification" content="{{ site.google_site_verification }}" />
|
||||
{% endif %}
|
||||
{% if site.bing_site_verification %}
|
||||
<meta name="msvalidate.01" content="{{ site.bing_site_verification }}">
|
||||
{% endif %}
|
||||
{% if site.alexa_site_verification %}
|
||||
<meta name="alexaVerifyID" content="{{ site.alexa_site_verification }}">
|
||||
{% endif %}
|
||||
{% if site.yandex_site_verification %}
|
||||
<meta name="yandex-verification" content="{{ site.yandex_site_verification }}">
|
||||
{% endif %}
|
||||
{% if site.naver_site_verification %}
|
||||
<meta name="naver-site-verification" content="{{ site.naver_site_verification }}">
|
||||
{% endif %}
|
||||
{% if site.baidu_site_verification %}
|
||||
<meta name="baidu-site-verification" content="{{ site.baidu_site_verification }}">
|
||||
{% endif %}
|
||||
<!-- end _includes/seo.html -->
|
||||
@@ -0,0 +1,21 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% if page.author_profile or layout.author_profile or page.sidebar %}
|
||||
<div class="sidebar sticky">
|
||||
{% if page.author_profile or layout.author_profile %}{% include author-profile.html locale=locale %}{% endif %}
|
||||
{% if page.sidebar %}
|
||||
{% for s in page.sidebar %}
|
||||
{% if s.image %}
|
||||
<img src="{{ s.image | relative_url }}"
|
||||
alt="{% if s.image_alt %}{{ s.image_alt }}{% endif %}">
|
||||
{% endif %}
|
||||
{% if s.title %}<h3>{{ s.title }}</h3>{% endif %}
|
||||
{% if s.text %}{{ s.text | markdownify }}{% endif %}
|
||||
{% if s.nav %}{% include nav_list locale=locale nav=s.nav %}{% endif %}
|
||||
{% endfor %}
|
||||
{% if page.sidebar.nav %}
|
||||
{% include nav_list locale=locale nav=page.sidebar.nav %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include sidebar-custom.html %}
|
||||
</div>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,8 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<nav class="skip-links" aria-label="Skip links">
|
||||
<ul>
|
||||
<li><a href="#site-nav" class="screen-reader-shortcut">{{ site.data.ui-text[locale].skip_primary_nav | default: 'Skip to primary navigation' }}</a></li>
|
||||
<li><a href="#main" class="screen-reader-shortcut">{{ site.data.ui-text[locale].skip_content | default: 'Skip to content' }}</a></li>
|
||||
<li><a href="#footer" class="screen-reader-shortcut">{{ site.data.ui-text[locale].skip_footer | default: 'Skip to footer' }}</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
@@ -0,0 +1,20 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<section class="page__share">
|
||||
<h4 class="page__share-title">{{ site.data.ui-text[locale].share_on_label | default: "Share on" }}</h4>
|
||||
|
||||
<a href="https://x.com/intent/tweet?{% if site.twitter.username %}via={{ site.twitter.username | url_encode }}&{% endif %}text={{ page.title | url_encode }}%20{{ page.url | absolute_url | url_encode }}" class="btn btn--x" aria-label="Share on X" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[locale].share_on_label | default: 'Share on' }} X">
|
||||
<i class="fab fa-fw fa-x-twitter" aria-hidden="true"></i><span> X</span>
|
||||
</a>
|
||||
|
||||
<a href="https://www.facebook.com/sharer/sharer.php?u={{ page.url | absolute_url | url_encode }}" class="btn btn--facebook" aria-label="Share on Facebook" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[locale].share_on_label | default: 'Share on' }} Facebook">
|
||||
<i class="fab fa-fw fa-facebook" aria-hidden="true"></i><span> Facebook</span>
|
||||
</a>
|
||||
|
||||
<a href="https://www.linkedin.com/shareArticle?mini=true&url={{ page.url | absolute_url }}" class="btn btn--linkedin" aria-label="Share on LinkedIn" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[locale].share_on_label | default: 'Share on' }} LinkedIn">
|
||||
<i class="fab fa-fw fa-linkedin" aria-hidden="true"></i><span> LinkedIn</span>
|
||||
</a>
|
||||
|
||||
<a href="https://bsky.app/intent/compose?text={{ page.title | url_encode }}%20{{ page.url | absolute_url | url_encode }}" class="btn btn--bluesky" onclick="window.open(this.href, 'window', 'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" title="{{ site.data.ui-text[locale].share_on_label | default: 'Share on' }} Bluesky">
|
||||
<i class="fab fa-fw fa-bluesky" aria-hidden="true"></i><span> Bluesky</span>
|
||||
</a>
|
||||
</section>
|
||||
@@ -0,0 +1,20 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
{% case site.tag_archive.type %}
|
||||
{% when "liquid" %}
|
||||
{% assign path_type = "#" %}
|
||||
{% when "jekyll-archives" %}
|
||||
{% assign path_type = nil %}
|
||||
{% endcase %}
|
||||
|
||||
{% if site.tag_archive.path %}
|
||||
{% assign tags_sorted = page.tags | sort_natural %}
|
||||
|
||||
<p class="page__taxonomy">
|
||||
<strong><i class="fas fa-fw fa-tags" aria-hidden="true"></i> {{ site.data.ui-text[locale].tags_label | default: "Tags:" }} </strong>
|
||||
<span itemprop="keywords">
|
||||
{% for tag_word in tags_sorted %}
|
||||
<a href="{{ tag_word | slugify | prepend: path_type | prepend: site.tag_archive.path | relative_url }}" class="page__taxonomy-item p-category" rel="tag">{{ tag_word }}</a>{% unless forloop.last %}<span class="sep">, </span>{% endunless %}
|
||||
{% endfor %}
|
||||
</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,8 @@
|
||||
{% assign locale = include.locale | default: site.locale %}
|
||||
<aside class="sidebar__right">
|
||||
<nav class="toc" markdown="1">
|
||||
<header><h4 class="nav__title"><i class="fas fa-{{ include.icon | default: 'file-alt' }}"></i> {{ include.title | default: site.data.ui-text[locale].toc_label }}</h4></header>
|
||||
* Auto generated table of contents
|
||||
{:toc .toc__menu}
|
||||
</nav>
|
||||
</aside>
|
||||
@@ -0,0 +1,189 @@
|
||||
{% capture tocWorkspace %}
|
||||
{% comment %}
|
||||
Copyright (c) 2017 Vladimir "allejo" Jimenez
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
{% endcomment %}
|
||||
{% comment %}
|
||||
Version 1.2.1
|
||||
https://github.com/allejo/jekyll-toc
|
||||
|
||||
"...like all things liquid - where there's a will, and ~36 hours to spare, there's usually a/some way" ~jaybe
|
||||
|
||||
Usage:
|
||||
{% include toc.html html=content sanitize=true class="inline_toc" id="my_toc" h_min=2 h_max=3 %}
|
||||
|
||||
Parameters:
|
||||
* html (string) - the HTML of compiled markdown generated by kramdown in Jekyll
|
||||
|
||||
Optional Parameters:
|
||||
* sanitize (bool) : false - when set to true, the headers will be stripped of any HTML in the TOC
|
||||
* class (string) : '' - a CSS class assigned to the TOC
|
||||
* id (string) : '' - an ID to assigned to the TOC
|
||||
* h_min (int) : 1 - the minimum TOC header level to use; any header lower than this value will be ignored
|
||||
* h_max (int) : 6 - the maximum TOC header level to use; any header greater than this value will be ignored
|
||||
* ordered (bool) : false - when set to true, an ordered list will be outputted instead of an unordered list
|
||||
* item_class (string) : '' - add custom class(es) for each list item; has support for '%level%' placeholder, which is the current heading level
|
||||
* submenu_class (string) : '' - add custom class(es) for each child group of headings; has support for '%level%' placeholder which is the current "submenu" heading level
|
||||
* base_url (string) : '' - add a base url to the TOC links for when your TOC is on another page than the actual content
|
||||
* anchor_class (string) : '' - add custom class(es) for each anchor element
|
||||
* skip_no_ids (bool) : false - skip headers that do not have an `id` attribute
|
||||
* flat_toc (bool) : false - when set to true, the TOC will be a single level list
|
||||
|
||||
Output:
|
||||
An ordered or unordered list representing the table of contents of a markdown block. This snippet will only
|
||||
generate the table of contents and will NOT output the markdown given to it
|
||||
{% endcomment %}
|
||||
|
||||
{% capture newline %}
|
||||
{% endcapture %}
|
||||
{% assign newline = newline | rstrip %} <!-- Remove the extra spacing but preserve the newline -->
|
||||
|
||||
{% capture deprecation_warnings %}{% endcapture %}
|
||||
|
||||
{% if include.baseurl %}
|
||||
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "baseurl" has been deprecated, use "base_url" instead -->{{ newline }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.skipNoIDs %}
|
||||
{% capture deprecation_warnings %}{{ deprecation_warnings }}<!-- jekyll-toc :: "skipNoIDs" has been deprecated, use "skip_no_ids" instead -->{{ newline }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture jekyll_toc %}{% endcapture %}
|
||||
{% assign orderedList = include.ordered | default: false %}
|
||||
{% assign flatToc = include.flat_toc | default: false %}
|
||||
{% assign baseURL = include.base_url | default: include.baseurl | default: '' %}
|
||||
{% assign skipNoIDs = include.skip_no_ids | default: include.skipNoIDs | default: false %}
|
||||
{% assign minHeader = include.h_min | default: 1 %}
|
||||
{% assign maxHeader = include.h_max | default: 6 %}
|
||||
{% assign nodes = include.html | strip | split: '<h' %}
|
||||
|
||||
{% assign firstHeader = true %}
|
||||
{% assign currLevel = 0 %}
|
||||
{% assign lastLevel = 0 %}
|
||||
|
||||
{% capture listModifier %}{% if orderedList %}ol{% else %}ul{% endif %}{% endcapture %}
|
||||
|
||||
{% for node in nodes %}
|
||||
{% if node == "" %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign currLevel = node | replace: '"', '' | slice: 0, 1 | times: 1 %}
|
||||
|
||||
{% if currLevel < minHeader or currLevel > maxHeader %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% assign _workspace = node | split: '</h' %}
|
||||
|
||||
{% assign _idWorkspace = _workspace[0] | split: 'id="' %}
|
||||
{% assign _idWorkspace = _idWorkspace[1] | split: '"' %}
|
||||
{% assign htmlID = _idWorkspace[0] %}
|
||||
|
||||
{% assign _classWorkspace = _workspace[0] | split: 'class="' %}
|
||||
{% assign _classWorkspace = _classWorkspace[1] | split: '"' %}
|
||||
{% assign htmlClass = _classWorkspace[0] %}
|
||||
|
||||
{% if htmlClass contains "no_toc" %}
|
||||
{% continue %}
|
||||
{% endif %}
|
||||
|
||||
{% if firstHeader %}
|
||||
{% assign minHeader = currLevel %}
|
||||
{% endif %}
|
||||
|
||||
{% capture _hAttrToStrip %}{{ _workspace[0] | split: '>' | first }}>{% endcapture %}
|
||||
{% assign header = _workspace[0] | replace: _hAttrToStrip, '' %}
|
||||
|
||||
{% if include.item_class and include.item_class != blank %}
|
||||
{% capture listItemClass %} class="{{ include.item_class | replace: '%level%', currLevel | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.submenu_class and include.submenu_class != blank %}
|
||||
{% assign subMenuLevel = currLevel | minus: 1 %}
|
||||
{% capture subMenuClass %} class="{{ include.submenu_class | replace: '%level%', subMenuLevel | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture anchorBody %}{% if include.sanitize %}{{ header | strip_html }}{% else %}{{ header }}{% endif %}{% endcapture %}
|
||||
|
||||
{% if htmlID %}
|
||||
{% capture anchorAttributes %} href="{% if baseURL %}{{ baseURL }}{% endif %}#{{ htmlID }}"{% endcapture %}
|
||||
|
||||
{% if include.anchor_class %}
|
||||
{% capture anchorAttributes %}{{ anchorAttributes }} class="{{ include.anchor_class | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture listItem %}<a{{ anchorAttributes }}>{{ anchorBody }}</a>{% endcapture %}
|
||||
{% elsif skipNoIDs == true %}
|
||||
{% continue %}
|
||||
{% else %}
|
||||
{% capture listItem %}{{ anchorBody }}{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if currLevel > lastLevel and flatToc == false %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}<{{ listModifier }}{{ subMenuClass }}>{% endcapture %}
|
||||
{% elsif currLevel < lastLevel and flatToc == false %}
|
||||
{% assign repeatCount = lastLevel | minus: currLevel %}
|
||||
|
||||
{% for i in (1..repeatCount) %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
|
||||
{% endfor %}
|
||||
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
|
||||
{% else %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li>{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}<li{{ listItemClass }}>{{ listItem }}{% endcapture %}
|
||||
|
||||
{% assign lastLevel = currLevel %}
|
||||
{% assign firstHeader = false %}
|
||||
{% endfor %}
|
||||
|
||||
{% if flatToc == true %}
|
||||
{% assign repeatCount = 1 %}
|
||||
{% else %}
|
||||
{% assign repeatCount = minHeader | minus: 1 %}
|
||||
{% assign repeatCount = lastLevel | minus: repeatCount %}
|
||||
{% endif %}
|
||||
|
||||
{% for i in (1..repeatCount) %}
|
||||
{% capture jekyll_toc %}{{ jekyll_toc }}</li></{{ listModifier }}>{% endcapture %}
|
||||
{% endfor %}
|
||||
|
||||
{% if jekyll_toc != '' %}
|
||||
{% assign rootAttributes = '' %}
|
||||
{% if include.class and include.class != blank %}
|
||||
{% capture rootAttributes %} class="{{ include.class | split: '.' | join: ' ' }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if include.id and include.id != blank %}
|
||||
{% capture rootAttributes %}{{ rootAttributes }} id="{{ include.id }}"{% endcapture %}
|
||||
{% endif %}
|
||||
|
||||
{% if rootAttributes %}
|
||||
{% assign nodes = jekyll_toc | split: '>' %}
|
||||
{% capture jekyll_toc %}<{{ listModifier }}{{ rootAttributes }}>{{ nodes | shift | join: '>' }}>{% endcapture %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endcapture %}{% assign tocWorkspace = '' %}{{ deprecation_warnings }}{{ jekyll_toc -}}
|
||||
@@ -0,0 +1,24 @@
|
||||
{% capture video_id %}{{ include.id }}{% endcapture %}
|
||||
{% capture video_provider %}{{ include.provider }}{% endcapture %}
|
||||
{% capture video_danmaku %}{{ include.danmaku | default: 0 }}{% endcapture %}
|
||||
|
||||
{% capture video_src %}
|
||||
{% case video_provider %}
|
||||
{% when "vimeo" %}
|
||||
https://player.vimeo.com/video/{{ video_id }}?dnt=true
|
||||
{% when "youtube" %}
|
||||
https://www.youtube-nocookie.com/embed/{{ video_id }}
|
||||
{% when "google-drive" %}
|
||||
https://drive.google.com/file/d/{{ video_id }}/preview
|
||||
{% when "bilibili" %}
|
||||
https://player.bilibili.com/player.html?bvid={{ video_id }}&page=1&as_wide=1&high_quality=1&danmaku={{ video_danmaku }}
|
||||
{% endcase %}
|
||||
{% endcapture %}
|
||||
{% assign video_src = video_src | strip %}
|
||||
|
||||
<!-- Courtesy of embedresponsively.com -->
|
||||
{% unless video_src == "" %}
|
||||
<div class="responsive-video-container">
|
||||
<iframe src="{{ video_src }}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowfullscreen></iframe>
|
||||
</div>
|
||||
{% endunless %}
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
layout: default
|
||||
author_profile: false
|
||||
---
|
||||
{%- assign locale = page.locale | default: layout.locale | default: site.locale %}
|
||||
|
||||
{% if page.header.overlay_color or page.header.overlay_image or page.header.image %}
|
||||
{% include page__hero.html locale=locale %}
|
||||
{% elsif page.header.video.id and page.header.video.provider %}
|
||||
{% include page__hero_video.html %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.url != "/" and site.breadcrumbs %}
|
||||
{% unless paginator %}
|
||||
{% include breadcrumbs.html locale=locale %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
<div id="main" role="main">
|
||||
{% include sidebar.html locale=locale %}
|
||||
|
||||
<div class="archive">
|
||||
{% unless page.header.overlay_color or page.header.overlay_image %}
|
||||
<h1 id="page-title" class="page__title"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>{{ page.title }}</h1>
|
||||
{% endunless %}
|
||||
{% for post in page.posts %}
|
||||
{% include archive-single.html locale=locale %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
{%- assign locale = page.locale | default: layout.locale | default: site.locale %}
|
||||
|
||||
{% if page.header.overlay_color or page.header.overlay_image or page.header.image %}
|
||||
{% include page__hero.html locale=locale %}
|
||||
{% elsif page.header.video.id and page.header.video.provider %}
|
||||
{% include page__hero_video.html %}
|
||||
{% endif %}
|
||||
|
||||
{% if page.url != "/" and site.breadcrumbs %}
|
||||
{% unless paginator %}
|
||||
{% include breadcrumbs.html locale=locale %}
|
||||
{% endunless %}
|
||||
{% endif %}
|
||||
|
||||
<div id="main" role="main">
|
||||
{% include sidebar.html locale=locale %}
|
||||
|
||||
<div class="archive">
|
||||
{% unless page.header.overlay_color or page.header.overlay_image %}
|
||||
<h1 id="page-title" class="page__title"{% if page.locale %} lang="{{ page.locale }}"{% endif %}>{{ page.title }}</h1>
|
||||
{% endunless %}
|
||||
{{ content }}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
layout: archive
|
||||
---
|
||||
{%- assign locale = page.locale | default: layout.locale | default: site.locale %}
|
||||
|
||||
{{ content }}
|
||||
|
||||
{% include posts-taxonomy.html locale=locale taxonomies=site.categories %}
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
layout: archive
|
||||
---
|
||||
{%- assign locale = page.locale | default: layout.locale | default: site.locale %}
|
||||
|
||||
{{ content }}
|
||||
|
||||
{% assign entries_layout = page.entries_layout | default: 'list' %}
|
||||
<div class="entries-{{ entries_layout }}">
|
||||
{% include posts-category.html locale=locale taxonomy=page.taxonomy type=entries_layout %}
|
||||
</div>
|
||||
@@ -0,0 +1,11 @@
|
||||
---
|
||||
layout: archive
|
||||
---
|
||||
{%- assign locale = page.locale | default: layout.locale | default: site.locale %}
|
||||
|
||||
{{ content }}
|
||||
|
||||
{% assign entries_layout = page.entries_layout | default: 'list' %}
|
||||
<div class="entries-{{ entries_layout }}">
|
||||
{% include documents-collection.html locale=locale collection=page.collection sort_by=page.sort_by sort_order=page.sort_order type=entries_layout %}
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# Jekyll layout that compresses HTML
|
||||
# v3.1.0
|
||||
# http://jch.penibelst.de/
|
||||
# © 2014–2015 Anatol Broder
|
||||
# MIT License
|
||||
---
|
||||
|
||||
{% capture _LINE_FEED %}
|
||||
{% endcapture %}{% if site.compress_html.ignore.envs contains jekyll.environment or site.compress_html.ignore.envs == "all" %}{{ content }}{% else %}{% capture _content %}{{ content }}{% endcapture %}{% assign _profile = site.compress_html.profile %}{% if site.compress_html.endings == "all" %}{% assign _endings = "html head body li dt dd optgroup option colgroup caption thead tbody tfoot tr td th" | split: " " %}{% else %}{% assign _endings = site.compress_html.endings %}{% endif %}{% for _element in _endings %}{% capture _end %}</{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _end %}{% endfor %}{% if _profile and _endings %}{% assign _profile_endings = _content | size | plus: 1 %}{% endif %}{% for _element in site.compress_html.startings %}{% capture _start %}<{{ _element }}>{% endcapture %}{% assign _content = _content | remove: _start %}{% endfor %}{% if _profile and site.compress_html.startings %}{% assign _profile_startings = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.comments == "all" %}{% assign _comments = "<!-- -->" | split: " " %}{% else %}{% assign _comments = site.compress_html.comments %}{% endif %}{% if _comments.size == 2 %}{% capture _comment_befores %}.{{ _content }}{% endcapture %}{% assign _comment_befores = _comment_befores | split: _comments.first %}{% for _comment_before in _comment_befores %}{% if forloop.first %}{% continue %}{% endif %}{% capture _comment_outside %}{% if _carry %}{{ _comments.first }}{% endif %}{{ _comment_before }}{% endcapture %}{% capture _comment %}{% unless _carry %}{{ _comments.first }}{% endunless %}{{ _comment_outside | split: _comments.last | first }}{% if _comment_outside contains _comments.last %}{{ _comments.last }}{% assign _carry = false %}{% else %}{% assign _carry = true %}{% endif %}{% endcapture %}{% assign _content = _content | remove_first: _comment %}{% endfor %}{% if _profile %}{% assign _profile_comments = _content | size | plus: 1 %}{% endif %}{% endif %}{% assign _pre_befores = _content | split: "<pre" %}{% assign _content = "" %}{% for _pre_before in _pre_befores %}{% assign _pres = _pre_before | split: "</pre>" %}{% assign _pres_after = "" %}{% if _pres.size != 0 %}{% if site.compress_html.blanklines %}{% assign _lines = _pres.last | split: _LINE_FEED %}{% capture _pres_after %}{% for _line in _lines %}{% assign _trimmed = _line | split: " " | join: " " %}{% if _trimmed != empty or forloop.last %}{% unless forloop.first %}{{ _LINE_FEED }}{% endunless %}{{ _line }}{% endif %}{% endfor %}{% endcapture %}{% else %}{% assign _pres_after = _pres.last | split: " " | join: " " %}{% endif %}{% endif %}{% capture _content %}{{ _content }}{% if _pre_before contains "</pre>" %}<pre{{ _pres.first }}</pre>{% endif %}{% unless _pre_before contains "</pre>" and _pres.size == 1 %}{{ _pres_after }}{% endunless %}{% endcapture %}{% endfor %}{% if _profile %}{% assign _profile_collapse = _content | size | plus: 1 %}{% endif %}{% if site.compress_html.clippings == "all" %}{% assign _clippings = "html head title base link meta style body article section nav aside h1 h2 h3 h4 h5 h6 hgroup header footer address p hr blockquote ol ul li dl dt dd figure figcaption main div table caption colgroup col tbody thead tfoot tr td th" | split: " " %}{% else %}{% assign _clippings = site.compress_html.clippings %}{% endif %}{% for _element in _clippings %}{% assign _edges = " <e;<e; </e>;</e>;</e> ;</e>" | replace: "e", _element | split: ";" %}{% assign _content = _content | replace: _edges[0], _edges[1] | replace: _edges[2], _edges[3] | replace: _edges[4], _edges[5] %}{% endfor %}{% if _profile and _clippings %}{% assign _profile_clippings = _content | size | plus: 1 %}{% endif %}{{ _content }}{% if _profile %} <table id="compress_html_profile_{{ site.time | date: "%Y%m%d" }}" class="compress_html_profile"> <thead> <tr> <td>Step <td>Bytes <tbody> <tr> <td>raw <td>{{ content | size }}{% if _profile_endings %} <tr> <td>endings <td>{{ _profile_endings }}{% endif %}{% if _profile_startings %} <tr> <td>startings <td>{{ _profile_startings }}{% endif %}{% if _profile_comments %} <tr> <td>comments <td>{{ _profile_comments }}{% endif %}{% if _profile_collapse %} <tr> <td>collapse <td>{{ _profile_collapse }}{% endif %}{% if _profile_clippings %} <tr> <td>clippings <td>{{ _profile_clippings }}{% endif %} </table>{% endif %}{% endif %}
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
---
|
||||
{%- assign locale = page.locale | default: layout.locale | default: site.locale %}
|
||||
|
||||
<!doctype html>
|
||||
{% include copyright.html %}
|
||||
<html lang="{{ locale | replace: "_", "-" | default: "en" }}" class="no-js">
|
||||
<head>
|
||||
{% include head.html locale=locale %}
|
||||
{% include head/custom.html %}
|
||||
</head>
|
||||
|
||||
<body class="layout--{{ page.layout | default: layout.layout }}{% if page.classes or layout.classes %}{{ page.classes | default: layout.classes | join: ' ' | prepend: ' ' }}{% endif %}" dir="{% if site.rtl %}rtl{% else %}ltr{% endif %}">
|
||||
{% include_cached skip-links.html locale=locale %}
|
||||
{% include_cached masthead.html locale=locale %}
|
||||
|
||||
<div class="initial-content">
|
||||
{{ content }}
|
||||
{% include after-content.html %}
|
||||
</div>
|
||||
|
||||
{% if site.search == true %}
|
||||
<div class="search-content">
|
||||
{% include_cached search/search_form.html locale=locale %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div id="footer" class="page__footer">
|
||||
<footer>
|
||||
{% include footer/custom.html %}
|
||||
{% include_cached footer.html locale=locale %}
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
{% include scripts.html locale=locale %}
|
||||
</body>
|
||||
</html>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user