Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor the theme common files, designed to be shared by multiple th…
…emes
- Loading branch information
saowang
committed
Oct 25, 2020
1 parent
cd58738
commit 0de2127
Showing
73 changed files
with
258 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Document Statement | ||
|
||
## templates | ||
|
||
Template files for this theme | ||
|
||
## common | ||
|
||
Some common variables and code snippets are designed to be shared by multiple themes |
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{%- include common/rest/site_pages.liquid -%} | ||
|
||
{{- site_pages | jsonify -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
User-agent: * | ||
Allow: / | ||
|
||
Sitemap: {{ "sitemap.xml" | absolute_url }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{%- include common/rest/site_pages.liquid -%} | ||
|
||
<?xml version="1.0" encoding="UTF-8"?> | ||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> | ||
{%- for page in site_pages -%} | ||
<url> | ||
<loc>{{ page.url | absolute_url | xml_escape }}</loc> | ||
<priority>{{ page.content | size | divided_by: 2048.0 | times: 10 | ceil | divided_by: 10.0 | at_least: 0.1 | at_most: 1.0 }}</priority> | ||
<lastmod>{{ site.time | date_to_xmlschema }}</lastmod> | ||
</url> | ||
{%- endfor %} | ||
</urlset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{%- include common/rest/site_pages.liquid -%} | ||
{%- include common/rest/workdir.liquid -%} | ||
|
||
{%- assign base = page.dir | append: "temp/" | split: "/" | size -%} | ||
{%- assign size = workdir_level | minus: base -%} | ||
{%- assign size_p1 = size | plus: 1 -%} | ||
|
||
{%- assign dir = site_pages | where: "url", workdir | first %} | ||
{% include common/rest/tabs.liquid size=size %}- [{{ dir.title | default: dir.url }}]({{ dir.url | relative_url }}) | ||
|
||
{%- for item in workdir_files %} | ||
{% include common/rest/tabs.liquid size=size_p1 %}- [{{ item.title | default: item.name }}]({{ item.url | relative_url }}) | ||
{%- endfor -%} | ||
|
||
{%- for workdir in workdir_dirs %}{% include common/core/_list.liquid %}{% endfor -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{%- include common/rest/site_pages.liquid -%} | ||
{%- include common/rest/workdir.liquid workdir=page.dir -%} | ||
|
||
{%- for item in workdir_files %} | ||
- [{{ item.title | default: item.name }}]({{ item.url | relative_url }}) | ||
{%- endfor -%} | ||
|
||
{%- if include.all -%} | ||
{%- for workdir in workdir_dirs %}{% include common/core/_list.liquid %}{% endfor -%} | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{%- if site.google.adsense -%} | ||
<script data-ad-client="{{ site.google.adsense }}" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{%- if site.google.gtag -%} | ||
<script async src="https://www.googletagmanager.com/gtag/js?id={{ site.google.gtag }}"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag() { | ||
dataLayer.push(arguments); | ||
} | ||
gtag("js", new Date()); | ||
gtag("config", "{{ site.google.gtag }}"); | ||
</script> | ||
{%- endif -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{%- if content contains '<code class="language-mermaid">' -%} | ||
{%- if site.mermaid.custom -%} | ||
<script src="{{ site.mermaid.custom }}"></script> | ||
{%- else -%} | ||
<script src="{{ base }}/assets/js/mermaid.min.js"></script> | ||
{%- endif %} | ||
<script> | ||
mermaid.initialize({% if site.mermaid.initialize %}{{ site.mermaid.initialize | jsonify }}{% else %}{}{% endif %}); | ||
</script> | ||
{%- endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, user-scalable=no"> | ||
<meta name="description" content="{{ description }}"> | ||
<meta name="revised" content="{{ docs.build_revision }}"> | ||
<meta name="author" content="{{ author }}"> | ||
<meta name="generator" content="{{ generator }} v{{ version }}"> | ||
|
||
{%- for meta in site.meta -%} | ||
<meta name="{{ meta.first }}" content="{{ meta.last }}"> | ||
{%- endfor -%} | ||
|
||
<meta name="theme-color" content="{{ theme_color }}"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<meta property="og:title" content="{{ title }}"> | ||
<meta property="og:description" content="{{ description }}"> | ||
<meta property="og:locale" content="{{ lang }}"> | ||
<meta property="og:url" content="{{ schema_surl }}"> | ||
<meta property="og:type" content="article"> | ||
<meta property="article:author" content="{{ author }}"> | ||
<meta property="article:published_time" content="{{ schema_date }}"> | ||
<meta property="article:modified_time" content="{{ schema_modi }}"> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
_includes/reset/navigation.liquid → _includes/common/rest/nav.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 11 additions & 10 deletions
21
_includes/reset/variables.liquid → _includes/common/rest/variables.liquid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,32 @@ | ||
{%- comment %} variables {% endcomment -%} | ||
{%- assign version = theme_alias | split: "@" | last -%} | ||
{%- assign docs = site.github -%} | ||
{%- assign rest = docs.public_repositories | where: "html_url", docs.repository_url | first -%} | ||
|
||
{%- assign rest_created_at = rest.created_at | default: site.time -%} | ||
{%- assign rest_updated_at = rest.updated_at | default: site.time -%} | ||
|
||
{%- comment %} defaults {% endcomment -%} | ||
{%- assign direction = site.direction | default: "auto" -%} | ||
{%- assign lang = site.lang | default: "en" -%} | ||
{%- assign author = docs.owner.name | default: docs.owner_name -%} | ||
|
||
{%- capture generator -%} | ||
{%- if site.remote_theme -%} | ||
{{- theme_alias | split: "@" | first -}} | ||
{%- else -%} | ||
{{- theme_alias | split: "@" | first | split: "/" | last -}} | ||
{%- endif -%} | ||
{%- endcapture -%} | ||
|
||
{%- comment %} schema {% endcomment -%} | ||
{%- assign schema_date = page.date | default: rest_created_at | date_to_xmlschema -%} | ||
{%- assign schema_modi = site.time | date_to_xmlschema -%} | ||
{%- assign schema_surl = page.url | absolute_url | xml_escape -%} | ||
|
||
{% comment %} custom {% endcomment %} | ||
{%- capture custom_scss -%} | ||
{%- include assets/custom.scss -%} {{- site.scss -}} | ||
{%- endcapture -%} | ||
|
||
{%- capture custom_script -%} | ||
{%- include assets/custom.js -%} {{- site.script -}} | ||
{%- endcapture -%} | ||
|
||
{% comment %} debug {% endcomment %} | ||
{%- if site.debug -%} | ||
{%- assign base = site.baseurl -%} | ||
{%- else -%} | ||
{%- assign base = "https://cdn.jsdelivr.net/gh/rundocs/jekyll-rtd-theme@" | append: version -%} | ||
{%- assign base = "https://cdn.jsdelivr.net/gh/" | append: theme_alias -%} | ||
{%- endif -%} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<meta name="twitter:title" content="{{ title }}"> | ||
<meta name="twitter:description" content="{{ description }}"> | ||
<meta name="twitter:card" content="summary"> | ||
<meta name="twitter:site" content="@{{ author }}"> | ||
<meta name="twitter:url" content="{{ schema_surl }}"> | ||
<meta name="twitter:creator" content="@{{ generator }} v{{ version }}"> |
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1 @@ | ||
{%- include reset/site_pages.liquid -%} | ||
{%- include reset/workdir.liquid workdir=page.dir -%} | ||
|
||
{%- for item in workdir_files %} | ||
- [{{ item.title | default: item.name }}]({{ item.url | relative_url }}) | ||
{%- endfor -%} | ||
|
||
{%- if include.all -%} | ||
{%- for workdir in workdir_dirs %}{% include extend/list.liquid %}{% endfor -%} | ||
{%- endif -%} | ||
{%- include common/core/list.liquid -%} |
Oops, something went wrong.