Merge branch 'master' into add-toc
This commit is contained in:
commit
dbeb0f7c98
10
.prettierrc
10
.prettierrc
@ -1,5 +1,11 @@
|
|||||||
{
|
{
|
||||||
"parser": "babylon",
|
"parser": "babel",
|
||||||
"printWidth": 100,
|
"printWidth": 100,
|
||||||
"trailingComma": "all"
|
"trailingComma": "all",
|
||||||
|
"overrides": [{
|
||||||
|
"files": ".html",
|
||||||
|
"options": {
|
||||||
|
"parser": "html"
|
||||||
|
}
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
- [Code highlighting](#code-highlighting)
|
- [Code highlighting](#code-highlighting)
|
||||||
- [How to start](#how-to-start)
|
- [How to start](#how-to-start)
|
||||||
- [How to configure](#how-to-configure)
|
- [How to configure](#how-to-configure)
|
||||||
|
- [Post archetype](#post-archetype)
|
||||||
- [Add-ons](#add-ons)
|
- [Add-ons](#add-ons)
|
||||||
- [How to run your site](#how-to-run-your-site)
|
- [How to run your site](#how-to-run-your-site)
|
||||||
- [How to edit the theme](#how-to-edit-the-theme)
|
- [How to edit the theme](#how-to-edit-the-theme)
|
||||||
@ -113,6 +114,10 @@ to `config.toml` file in your Hugo root directory and change params fields. In c
|
|||||||
|
|
||||||
**NOTE:** Please keep in mind that currently `main menu` doesn't support nesting.
|
**NOTE:** Please keep in mind that currently `main menu` doesn't support nesting.
|
||||||
|
|
||||||
|
## Post archetype
|
||||||
|
|
||||||
|
See the basic `post` file params supported by the theme — https://github.com/panr/hugo-theme-terminal/blob/master/archetypes/post.md
|
||||||
|
|
||||||
## Add-ons
|
## Add-ons
|
||||||
|
|
||||||
- **Comments** — for adding comments to your blog posts please take a look at `layouts/partials/comments.html` https://github.com/panr/hugo-theme-terminal/blob/master/layouts/partials/comments.html.
|
- **Comments** — for adding comments to your blog posts please take a look at `layouts/partials/comments.html` https://github.com/panr/hugo-theme-terminal/blob/master/layouts/partials/comments.html.
|
||||||
|
9
archetypes/post.md
Normal file
9
archetypes/post.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
+++
|
||||||
|
title = ""
|
||||||
|
date = ""
|
||||||
|
author = ""
|
||||||
|
cover = ""
|
||||||
|
tags = ["", ""]
|
||||||
|
description = ""
|
||||||
|
showFullContent = false
|
||||||
|
+++
|
@ -1,43 +1,55 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class="posts">
|
<div class="posts">
|
||||||
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
|
{{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }}
|
||||||
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
|
{{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }}
|
||||||
{{ $paginator := .Paginate (where .Data.Pages "Type" $contentTypeName) }}
|
{{ $paginator := .Paginate (where .Data.Pages "Type" $contentTypeName) }}
|
||||||
|
|
||||||
{{ range $paginator.Pages }}
|
{{ range $paginator.Pages }}
|
||||||
<div class="post on-list">
|
<div class="post on-list">
|
||||||
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
|
<h1 class="post-title">
|
||||||
<div class="post-meta">
|
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
|
||||||
<span class="post-date">
|
<div class="post-meta">
|
||||||
{{ .Date.Format "2006-01-02" }}
|
<span class="post-date">
|
||||||
</span>
|
{{ .Date.Format "2006-01-02" }}
|
||||||
{{ with .Params.Author }}<span class="post-author">:: {{ . }}</span>{{ end }}
|
</span>
|
||||||
</div>
|
{{ with .Params.Author }}<span class="post-author">::
|
||||||
|
{{ . }}</span>{{ end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ if .Params.tags }}
|
{{ if .Params.tags }}
|
||||||
<span class="post-tags">
|
<span class="post-tags">
|
||||||
{{ range .Params.tags }}
|
{{ range .Params.tags }}
|
||||||
#<a href="{{ (urlize (printf "tags/%s/" . )) | absURL }}">{{ . }}</a>
|
#<a href="{{ (urlize (printf "tags/%s/" . )) | absURL }}">
|
||||||
{{ end }}
|
{{- . -}}
|
||||||
</span>
|
</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
</span>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ with .Params.Cover }}
|
{{ with .Params.Cover }}
|
||||||
<img src="{{ . | absURL }}" class="post-cover" />
|
<img src="{{ . | absURL }}" class="post-cover" />
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
<div class="post-content">
|
||||||
|
{{ if .Params.showFullContent }}
|
||||||
|
{{ .Content | markdownify }}
|
||||||
|
{{ else if .Description }}
|
||||||
|
{{ .Description | markdownify }}
|
||||||
|
{{ else }}
|
||||||
|
{{ if .Truncated }}
|
||||||
|
{{ .Summary | markdownify }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="post-content">
|
{{ if not .Params.showFullContent }}
|
||||||
{{ with .Description }}
|
<div>
|
||||||
{{ . | markdownify }}
|
<a class="read-more button"
|
||||||
{{ else }}
|
href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a>
|
||||||
{{ if .Truncated }}
|
|
||||||
{{ .Summary | markdownify }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
<div><a class="read-more button" href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a></div>
|
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ partial "pagination.html" . }}
|
|
||||||
</div>
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
{{ partial "pagination.html" . }}
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -1,26 +1,31 @@
|
|||||||
{{ define "main" }}
|
{{ define "main" }}
|
||||||
<div class="post">
|
<div class="post">
|
||||||
<h1 class="post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
|
<h1 class="post-title">
|
||||||
<div class="post-meta">
|
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
|
||||||
<span class="post-date">
|
<div class="post-meta">
|
||||||
{{ .Date.Format "2006-01-02" }}
|
<span class="post-date">
|
||||||
</span>
|
{{ .Date.Format "2006-01-02" }}
|
||||||
{{ with .Params.Author }}<span class="post-author">:: {{ . }}</span>{{ end }}
|
</span>
|
||||||
</div>
|
{{ with .Params.Author }}
|
||||||
|
<span class="post-author">::
|
||||||
{{ if .Params.tags }}
|
{{ . }}
|
||||||
<span class="post-tags">
|
</span>
|
||||||
{{ range .Params.tags }}
|
|
||||||
#<a href="{{ (urlize (printf "tags/%s/" .)) | absURL }}">{{ . }}</a>
|
|
||||||
{{ end }}
|
|
||||||
</span>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
|
||||||
{{ with .Params.Cover }}
|
{{ if .Params.tags }}
|
||||||
<img src="{{ . | absURL }}" class="post-cover" />
|
<span class="post-tags">
|
||||||
|
{{ range .Params.tags }}
|
||||||
|
#<a href="{{ (urlize (printf "tags/%s/" .)) | absURL }}">{{ . }}</a>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
</span>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ with .Params.Cover }}
|
||||||
|
<img src="{{ . | absURL }}" class="post-cover" />
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ if .Params.Toc }}
|
{{ if .Params.Toc }}
|
||||||
<div class="table-of-contents">
|
<div class="table-of-contents">
|
||||||
<h1>
|
<h1>
|
||||||
{{ if .Params.TocTitle }}
|
{{ if .Params.TocTitle }}
|
||||||
@ -33,38 +38,39 @@
|
|||||||
</h1>
|
</h1>
|
||||||
{{ .TableOfContents }}
|
{{ .TableOfContents }}
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<div class="post-content">
|
<div class="post-content">
|
||||||
{{ .Content }}
|
{{ .Content }}
|
||||||
</div>
|
|
||||||
{{ if or .NextInSection .PrevInSection }}
|
|
||||||
<div class="pagination">
|
|
||||||
<div class="pagination__title">
|
|
||||||
<span class="pagination__title-h">{{ $.Site.Params.ReadOtherPosts }}</span>
|
|
||||||
<hr />
|
|
||||||
</div>
|
|
||||||
<div class="pagination__buttons">
|
|
||||||
{{ if .NextInSection }}
|
|
||||||
<span class="button previous">
|
|
||||||
<a href="{{ .NextInSection.Permalink }}">
|
|
||||||
<span class="button__icon">←</span>
|
|
||||||
<span class="button__text">{{ .NextInSection.Title }}</span>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
{{ end }}
|
|
||||||
{{ if .PrevInSection }}
|
|
||||||
<span class="button next">
|
|
||||||
<a href="{{ .PrevInSection.Permalink }}">
|
|
||||||
<span class="button__text">{{ .PrevInSection.Title }}</span>
|
|
||||||
<span class="button__icon">→</span>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
{{ end }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{ end }}
|
|
||||||
|
|
||||||
{{ partial "comments.html" . }}
|
|
||||||
</div>
|
</div>
|
||||||
|
{{ if or .NextInSection .PrevInSection }}
|
||||||
|
<div class="pagination">
|
||||||
|
<div class="pagination__title">
|
||||||
|
<span
|
||||||
|
class="pagination__title-h">{{ $.Site.Params.ReadOtherPosts }}</span>
|
||||||
|
<hr />
|
||||||
|
</div>
|
||||||
|
<div class="pagination__buttons">
|
||||||
|
{{ if .NextInSection }}
|
||||||
|
<span class="button previous">
|
||||||
|
<a href="{{ .NextInSection.Permalink }}">
|
||||||
|
<span class="button__icon">←</span>
|
||||||
|
<span class="button__text">{{ .NextInSection.Title }}</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
{{ end }}
|
||||||
|
{{ if .PrevInSection }}
|
||||||
|
<span class="button next">
|
||||||
|
<a href="{{ .PrevInSection.Permalink }}">
|
||||||
|
<span class="button__text">{{ .PrevInSection.Title }}</span>
|
||||||
|
<span class="button__icon">→</span>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
{{ end }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ partial "comments.html" . }}
|
||||||
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
@ -16,9 +16,11 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.2.3",
|
"@babel/cli": "^7.2.3",
|
||||||
"@babel/core": "^7.2.2",
|
"@babel/core": "^7.2.2",
|
||||||
|
"@babel/parser": "^7.4.2",
|
||||||
"@babel/plugin-transform-runtime": "^7.2.0",
|
"@babel/plugin-transform-runtime": "^7.2.0",
|
||||||
"@babel/preset-env": "^7.3.1",
|
"@babel/preset-env": "^7.3.1",
|
||||||
"@babel/preset-stage-2": "^7.0.0",
|
"@babel/preset-stage-2": "^7.0.0",
|
||||||
|
"angular-html-parser": "^1.2.0",
|
||||||
"babel-eslint": "^8.2.1",
|
"babel-eslint": "^8.2.1",
|
||||||
"babel-loader": "^8.0.5",
|
"babel-loader": "^8.0.5",
|
||||||
"browserslist": "^4.0.1",
|
"browserslist": "^4.0.1",
|
||||||
|
@ -51,3 +51,51 @@ code.language-html {
|
|||||||
.token.namespace {
|
.token.namespace {
|
||||||
opacity: .7;
|
opacity: .7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pre[data-line] {
|
||||||
|
position: relative;
|
||||||
|
padding: 1em 0 1em 3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-highlight {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: inherit 0;
|
||||||
|
margin-top: 1em;
|
||||||
|
/* Same as .prism’s padding-top */
|
||||||
|
background: hsla(24, 20%, 50%, .08);
|
||||||
|
background: linear-gradient(to right, hsla(24, 20%, 50%, .1) 70%, hsla(24, 20%, 50%, 0));
|
||||||
|
pointer-events: none;
|
||||||
|
line-height: inherit;
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-highlight:before,
|
||||||
|
.line-highlight[data-end]:after {
|
||||||
|
content: attr(data-start);
|
||||||
|
position: absolute;
|
||||||
|
top: .4em;
|
||||||
|
left: .6em;
|
||||||
|
min-width: 1em;
|
||||||
|
padding: 0 .5em;
|
||||||
|
background-color: hsla(24, 20%, 50%, .4);
|
||||||
|
color: hsl(24, 20%, 95%);
|
||||||
|
font: bold 65%/1.5 sans-serif;
|
||||||
|
text-align: center;
|
||||||
|
vertical-align: .3em;
|
||||||
|
border-radius: 999px;
|
||||||
|
text-shadow: none;
|
||||||
|
box-shadow: 0 1px white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-highlight[data-end]:after {
|
||||||
|
content: attr(data-end);
|
||||||
|
top: auto;
|
||||||
|
bottom: .4em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.line-numbers .line-highlight:before,
|
||||||
|
.line-numbers .line-highlight:after {
|
||||||
|
content: none;
|
||||||
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -91,10 +91,9 @@
|
|||||||
!*** ./source/js/main.js ***!
|
!*** ./source/js/main.js ***!
|
||||||
\***************************/
|
\***************************/
|
||||||
/*! no static exports found */
|
/*! no static exports found */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
"use strict";
|
eval("// Add your script here\n\n//# sourceURL=webpack:///./source/js/main.js?");
|
||||||
eval("// Add your script here\n\n\n//# sourceURL=webpack:///./source/js/main.js?");
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
@ -103,10 +102,9 @@ eval("// Add your script here\n\n\n//# sourceURL=webpack:///./source/js/main.js?
|
|||||||
!*** ./source/js/menu.js ***!
|
!*** ./source/js/menu.js ***!
|
||||||
\***************************/
|
\***************************/
|
||||||
/*! no static exports found */
|
/*! no static exports found */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
"use strict";
|
eval("var container = document.querySelector(\".container\");\nvar menu = document.querySelector(\".menu\");\nvar mobileMenuTrigger = document.querySelector(\".menu-trigger\");\nvar desktopMenu = document.querySelector(\".menu__inner--desktop\");\nvar desktopMenuTrigger = document.querySelector(\".menu__sub-inner-more-trigger\");\nvar menuMore = document.querySelector(\".menu__sub-inner-more\");\nvar mobileQuery = getComputedStyle(document.body).getPropertyValue(\"--phoneWidth\");\n\nvar isMobile = function isMobile() {\n return window.matchMedia(mobileQuery).matches;\n};\n\nvar handleMenuClasses = function handleMenuClasses() {\n mobileMenuTrigger && mobileMenuTrigger.classList.toggle(\"hidden\", !isMobile());\n menu && menu.classList.toggle(\"hidden\", isMobile());\n menuMore && menuMore.classList.toggle(\"hidden\", !isMobile());\n}; // Common\n\n\nmenu && menu.addEventListener(\"click\", function (e) {\n return e.stopPropagation();\n});\nmenuMore && menuMore.addEventListener(\"click\", function (e) {\n return e.stopPropagation();\n});\nhandleMenuClasses();\ndocument.body.addEventListener(\"click\", function () {\n if (!isMobile() && menuMore && !menuMore.classList.contains(\"hidden\")) {\n menuMore.classList.add(\"hidden\");\n } else if (isMobile() && !menu.classList.contains(\"hidden\")) {\n menu.classList.add(\"hidden\");\n }\n});\nwindow.addEventListener(\"resize\", handleMenuClasses); // Mobile menu\n\nmobileMenuTrigger && mobileMenuTrigger.addEventListener(\"click\", function (e) {\n e.stopPropagation();\n menu && menu.classList.toggle(\"hidden\");\n}); // Desktop menu\n\ndesktopMenuTrigger && desktopMenuTrigger.addEventListener(\"click\", function (e) {\n e.stopPropagation();\n menuMore && menuMore.classList.toggle(\"hidden\");\n\n if (menuMore.getBoundingClientRect().right > container.getBoundingClientRect().right) {\n menuMore.style.left = \"auto\";\n menuMore.style.right = 0;\n }\n});\n\n//# sourceURL=webpack:///./source/js/menu.js?");
|
||||||
eval("\n\nvar container = document.querySelector(\".container\");\nvar menu = document.querySelector(\".menu\");\nvar mobileMenuTrigger = document.querySelector(\".menu-trigger\");\nvar desktopMenu = document.querySelector(\".menu__inner--desktop\");\nvar desktopMenuTrigger = document.querySelector(\".menu__sub-inner-more-trigger\");\nvar menuMore = document.querySelector(\".menu__sub-inner-more\");\nvar mobileQuery = getComputedStyle(document.body).getPropertyValue(\"--phoneWidth\");\n\nvar isMobile = function isMobile() {\n return window.matchMedia(mobileQuery).matches;\n};\n\nvar handleMenuClasses = function handleMenuClasses() {\n mobileMenuTrigger && mobileMenuTrigger.classList.toggle(\"hidden\", !isMobile());\n menu && menu.classList.toggle(\"hidden\", isMobile());\n menuMore && menuMore.classList.toggle(\"hidden\", !isMobile());\n}; // Common\n\n\nmenu && menu.addEventListener(\"click\", function (e) {\n return e.stopPropagation();\n});\nmenuMore && menuMore.addEventListener(\"click\", function (e) {\n return e.stopPropagation();\n});\nhandleMenuClasses();\ndocument.body.addEventListener(\"click\", function () {\n if (!isMobile() && menuMore && !menuMore.classList.contains(\"hidden\")) {\n menuMore.classList.add(\"hidden\");\n } else if (isMobile() && !menu.classList.contains(\"hidden\")) {\n menu.classList.add(\"hidden\");\n }\n});\nwindow.addEventListener(\"resize\", handleMenuClasses); // Mobile menu\n\nmobileMenuTrigger && mobileMenuTrigger.addEventListener(\"click\", function (e) {\n e.stopPropagation();\n menu && menu.classList.toggle(\"hidden\");\n}); // Desktop menu\n\ndesktopMenuTrigger && desktopMenuTrigger.addEventListener(\"click\", function (e) {\n e.stopPropagation();\n menuMore && menuMore.classList.toggle(\"hidden\");\n\n if (menuMore.getBoundingClientRect().right > container.getBoundingClientRect().right) {\n menuMore.style.left = \"auto\";\n menuMore.style.right = 0;\n }\n});\n\n//# sourceURL=webpack:///./source/js/menu.js?");
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user