Hugo内容
This commit is contained in:
20
Hugo/themes/nostyleplease/LICENSE
Normal file
20
Hugo/themes/nostyleplease/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 YOUR_NAME_HERE
|
||||
|
||||
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.
|
||||
85
Hugo/themes/nostyleplease/README.md
Normal file
85
Hugo/themes/nostyleplease/README.md
Normal file
@@ -0,0 +1,85 @@
|
||||
# no style, please!
|
||||
|
||||
<img src="https://raw.githubusercontent.com/hanwenguo/hugo-theme-nostyleplease/main/logo.png" width="64" align="left" />A (nearly) no-CSS, fast, minimalist [Hugo](https://gohugo.io/) theme ported from [riggraz/no-style-please](https://github.com/riggraz/no-style-please/).
|
||||
|
||||
<img src="https://raw.githubusercontent.com/hanwenguo/hugo-theme-nostyleplease/main/images/screenshot-both.png" />
|
||||
|
||||
## Features
|
||||
|
||||
* Fast (**under 3kb of CSS!**)
|
||||
* Light, dark and auto modes
|
||||
* Responsive
|
||||
* Content first (typography optimized for maximum readability)
|
||||
* RSS feed (using Hugo's embedded RSS template)
|
||||
* MathJax support
|
||||
* Supporting details HTML tag
|
||||
|
||||
## Installation
|
||||
|
||||
The easiest way is to clone this repo (or add as a submodule) to themes/nostyleplease then append `theme = 'nostyleplease'` as a newline to config.toml. Pages shipped with theme as examples have `draft: true` in their frontmatters, use `--buildDrafts` to build them.
|
||||
|
||||
## Usage
|
||||
|
||||
You can edit `config.toml` file to customize your blog. You can change things such as the name of the blog, the author, the appearance of the theme (light, dark or auto), how dates are formatted, etc. Customizable fields should be straightforward to understand. Still, `config.toml` contains some comments to help you understand what each field does. Note that the `config.toml` under root directory of your hugo site will completely override the one in the theme directory, so copy the attributes you want to keep or edit from the theme's `config.toml` to your site's `config.toml`.
|
||||
|
||||
### Customize the menu
|
||||
|
||||
In order to add/edit/delete entries from the main menu, you have to edit the `menu.toml` file inside `data` folder. Through that file you can define the structure of the menu. Take a look at the default configuration to get an idea of how it works and read on for a more comprehensive explanation.
|
||||
|
||||
The `menu.toml` file accepts the following fields:
|
||||
|
||||
- `entries` define a new unordered list that will contain menu entries
|
||||
- each entry is a member of the TOML array `entries` in question
|
||||
- each entry can have the following attributes:
|
||||
- `title`, which defines the text to render for this menu entry (**NB: you can also specify HTML!**)
|
||||
- `url`, which can be used to specify an URL for this entry. If not specified, `title` will be rendered as-is; otherwise `title` will be sorrounded by a link tag pointing to the specified URL. Note that the URL can either be relative or absolute. Also note that you can get the same result by placing an ```<a>``` tag in the `title` field.
|
||||
- `post_list`, which can be set either to `true` or to an object. If it is true, the entry will have a list of all posts as subentries. This is used to render your post list. If you want to customize which posts to render (e.g. by section), you can add one or more of the following attributes under `post_list`:
|
||||
- `section`, which can be set to a string. It is used to render a list of posts of the specified section only. If you don't set it, then posts of all sections will be rendered.
|
||||
- `limit`, which can be set to a number. It specifies the number of posts to show. If not set, all posts will be rendered.
|
||||
- `show_more`, which can be true. If it is true and if the number of posts to show is greater than the specified `limit`, render a link to another page. To specify the URL and the text of the link, you can set `show_more_url` and `show_more_text` attributes, which are documented below.
|
||||
- `show_more_url`, which can be a string. It specifies the URL for the show more link. Use only if `show_more` is true. This will usually redirect to a page containing all posts, which you can easily create using an section page (see [section pages](#section-pages) section)
|
||||
- `show_more_text`, which can be a string. It specifies the text for the show more link. Use only if `show_more` is true.
|
||||
- `entries`, yes, you can have entries inside entries. In this way you can create nested sublists!
|
||||
|
||||
### Section pages
|
||||
|
||||
A so-called section page is a page that shows a list of posts in a specific section. It should be automatically created by hugo when a new section is created.
|
||||
|
||||
### Customize the index page
|
||||
|
||||
The `index.md` page should use layout `home`, which is the layout that displays the menu. If you want to have some content after the menu, you can just add that content in the `_index.md` file, and it will automatically show under the menu.
|
||||
|
||||
Another thing you can do to customize the index page is show the description of your blog between the title and the menu. To do this, just edit `config.toml` and change `params.theme_config.show_description` to `true`.
|
||||
|
||||
You can also add footer. Just edit ..nostyleplease/layouts/footer.md.
|
||||
### Adding table of contents
|
||||
|
||||
You can add a table of contents by supplying the `toc: true` param to your post front matter. If you want a border around it you can also set `tocBorder: true`. The toc style behavior is handled by Goldmark and the defaults can be found in the `config.toml` file.
|
||||
|
||||
### Posts list group by date in descending order.
|
||||
|
||||
just edit `config.toml` and change `params.theme_config.isListGroupByDate` to `true`.
|
||||
|
||||
### Pro tips
|
||||
|
||||
#### Dark mode for images
|
||||
|
||||
This theme provides dark mode by inverting all colors of light mode throught the CSS `invert()` function. This approach would also invert the color of all images, but, since this is not the behaviour one would expect, images are not inverted by default.
|
||||
|
||||
However, if you would like to force the color inversion on a specific image you can do so by applying `class="ioda"` to that image ("ioda" stands for "invert on dark appearance"). See the image in the [overview post](https://github.com/riggraz/no-style-please/blob/master/_posts/2020-07-07-overview-post.md) for an example of this approach. Note that color inversion will take place only when the theme has dark appearance!
|
||||
|
||||
For example, if you have a black and white image it could make sense to invert it in dark mode. On the other hand, a colorful image will probably look bad if inverted.
|
||||
|
||||
## Contributing
|
||||
|
||||
Bug reports and pull requests are welcome on GitHub at https://github.com/hanwenguo/hugo-theme-nostyleplease/.
|
||||
|
||||
## Thanks
|
||||
|
||||
Some of the code comes from [wooseopkim/hugo-theme-nostyleplease](https://github.com/wooseopkim/hugo-theme-nostyleplease), a fork of this theme.
|
||||
|
||||
Some of the test pages are from [this jekyll theme](https://github.com/huangyz0918/moving).
|
||||
|
||||
## License
|
||||
|
||||
The theme is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
||||
181
Hugo/themes/nostyleplease/assets/css/main.scss
Normal file
181
Hugo/themes/nostyleplease/assets/css/main.scss
Normal file
@@ -0,0 +1,181 @@
|
||||
// -------------- THEME SWITCHER -------------- //
|
||||
@mixin theme($--bg-color, $--primary-text-color, $--secondary-text-color, $--link-color, $--visited-link-color, $--highlight) {
|
||||
background-color: $--bg-color;
|
||||
|
||||
color: $--primary-text-color;
|
||||
|
||||
a {
|
||||
color: $--link-color;
|
||||
&:visited { color: $--visited-link-color; }
|
||||
}
|
||||
|
||||
details {
|
||||
border: thin solid $--primary-text-color;
|
||||
}
|
||||
|
||||
details summary {
|
||||
color: $--primary-text-color;
|
||||
}
|
||||
|
||||
details[open] summary {
|
||||
border-bottom: 1px solid $--primary-text-color;
|
||||
}
|
||||
|
||||
pre {
|
||||
background: $--bg-color;
|
||||
}
|
||||
|
||||
code:not(pre > code) {
|
||||
background-color: $--primary-text-color;
|
||||
color: $--bg-color;
|
||||
}
|
||||
|
||||
*:target {
|
||||
background: $--highlight;
|
||||
color: $--primary-text-color;
|
||||
}
|
||||
|
||||
table, th, td {
|
||||
border: thin solid $--primary-text-color;
|
||||
}
|
||||
|
||||
.toc {
|
||||
border: thin solid $--primary-text-color;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
figcaption { color: $--secondary-text-color; }
|
||||
|
||||
blockquote {
|
||||
border: thin solid $--primary-text-color;
|
||||
}
|
||||
}
|
||||
|
||||
@mixin dark-appearance {
|
||||
@include theme(#000000, #ffffff, #000000, #79a8ff, #f78fe7, #2f3849); // modus-vivendi
|
||||
}
|
||||
|
||||
@mixin light-appearance {
|
||||
@include theme(#ffffff, #000000, #595959, #3548cf, #8f0075, #dae5ec); // modus-operandi
|
||||
}
|
||||
|
||||
body[a="dark"] { @include dark-appearance; }
|
||||
body[a="light"] { @include light-appearance; }
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
body[a="auto"] { @include dark-appearance; }
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: light) {
|
||||
body[a="auto"] { @include light-appearance; }
|
||||
}
|
||||
|
||||
// -------------------------------------------- //
|
||||
|
||||
html { height: 100%; }
|
||||
|
||||
body {
|
||||
font-family: monospace;
|
||||
font-size: 16px;
|
||||
line-height: 1.4;
|
||||
margin: 0;
|
||||
min-height: 100%;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
h2, h3, h4, h5, h6 { margin-top: 1.5rem; }
|
||||
|
||||
p { margin: 1rem 0; }
|
||||
|
||||
li { margin: 0.4rem 0; }
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
&:hover { text-decoration: underline; }
|
||||
}
|
||||
|
||||
hr {
|
||||
text-align: center;
|
||||
border: 0;
|
||||
margin: 2rem 0;
|
||||
|
||||
&:before { content: '/////' }
|
||||
&:after { content: attr(data-content) '/////' }
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 1em;
|
||||
overflow-x: auto; /* Fix pre content overflowing parent without scroll bar */
|
||||
}
|
||||
|
||||
table { width: 100%; }
|
||||
|
||||
table, th, td {
|
||||
border-collapse: collapse;
|
||||
padding: 0.4rem;
|
||||
}
|
||||
|
||||
code {
|
||||
text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
-moz-text-size-adjust: 100%;
|
||||
-webkit-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
code:not(pre > code) {
|
||||
padding: 0.1em 0.2em;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
code.has-jax {
|
||||
-webkit-font-smoothing: antialiased;
|
||||
background: inherit !important;
|
||||
border: none !important;
|
||||
font-size: 100%;
|
||||
}
|
||||
|
||||
blockquote {
|
||||
padding: 1rem;
|
||||
|
||||
p { margin: 0; }
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
figcaption {
|
||||
text-align: center;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
details {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
details summary {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
details[open] summary {
|
||||
margin-bottom: 0.5em;
|
||||
padding-bottom: 0.5em;
|
||||
}
|
||||
|
||||
.post-meta {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.w {
|
||||
max-width: 640px;
|
||||
margin: 0 auto;
|
||||
padding: 4rem 2rem;
|
||||
}
|
||||
|
||||
.toc {
|
||||
padding: 1rem;
|
||||
}
|
||||
9
Hugo/themes/nostyleplease/assets/js/mouse_coords.js
Normal file
9
Hugo/themes/nostyleplease/assets/js/mouse_coords.js
Normal file
@@ -0,0 +1,9 @@
|
||||
const p = document.createElement("p");
|
||||
p.style.textAlign = "center";
|
||||
p.style.fontSize = "18pt";
|
||||
p.innerHTML = "C'mon, move your mouse!"
|
||||
document.body.append(p);
|
||||
|
||||
document.addEventListener("mousemove", e => {
|
||||
p.innerHTML = `mouseX: ${e.clientX}, mouseY: ${e.clientY}`;
|
||||
});
|
||||
39
Hugo/themes/nostyleplease/config.toml
Normal file
39
Hugo/themes/nostyleplease/config.toml
Normal file
@@ -0,0 +1,39 @@
|
||||
[module]
|
||||
[module.hugoVersion]
|
||||
extended = true
|
||||
min = "0.41.0"
|
||||
|
||||
[markup]
|
||||
[markup.goldmark]
|
||||
[markup.goldmark.parser]
|
||||
[markup.goldmark.parser.attribute]
|
||||
block = true
|
||||
title = true
|
||||
|
||||
[markup.highlight]
|
||||
anchorLineNos = false
|
||||
codeFences = true
|
||||
guessSyntax = false
|
||||
hl_Lines = ''
|
||||
hl_inline = false
|
||||
lineAnchors = ''
|
||||
lineNoStart = 1
|
||||
lineNos = false
|
||||
lineNumbersInTable = true
|
||||
noClasses = true
|
||||
noHl = false
|
||||
style = 'rrt'
|
||||
tabWidth = 4
|
||||
|
||||
[markup.tableOfContents]
|
||||
startLevel = 2
|
||||
endLevel = 3
|
||||
ordered = false
|
||||
|
||||
[params]
|
||||
[params.theme_config]
|
||||
appearance = "auto"
|
||||
back_home_text = ".."
|
||||
date_format = "2006-01-02"
|
||||
isListGroupByDate = false
|
||||
isShowFooter = true
|
||||
25
Hugo/themes/nostyleplease/data/menu.toml
Normal file
25
Hugo/themes/nostyleplease/data/menu.toml
Normal file
@@ -0,0 +1,25 @@
|
||||
[[entries]]
|
||||
title = "info"
|
||||
|
||||
[[entries.entries]]
|
||||
title = "github repo"
|
||||
url = "https://github.com/taynpg"
|
||||
|
||||
|
||||
[[entries]]
|
||||
title = "all posts"
|
||||
|
||||
[entries.post_list]
|
||||
limit = 5
|
||||
show_more = true
|
||||
show_more_text = "See archive..."
|
||||
show_more_url = "posts"
|
||||
|
||||
[[entries]]
|
||||
title = "posts by category"
|
||||
|
||||
[entries.post_list]
|
||||
section = "posts"
|
||||
show_more = true
|
||||
show_more_text = "See more posts..."
|
||||
show_more_url = "posts"
|
||||
8
Hugo/themes/nostyleplease/layouts/404.html
Normal file
8
Hugo/themes/nostyleplease/layouts/404.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ define "main" }}
|
||||
|
||||
{{- partial "back_link.html" . -}}
|
||||
|
||||
<header>
|
||||
<h1>404 Not Found</h1>
|
||||
</header>
|
||||
{{ end }}
|
||||
12
Hugo/themes/nostyleplease/layouts/_default/baseof.html
Normal file
12
Hugo/themes/nostyleplease/layouts/_default/baseof.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ $.Site.LanguageCode }}">
|
||||
{{- partial "head.html" . -}}
|
||||
<body a="{{ $.Site.Params.theme_config.appearance | default "auto" }}">
|
||||
<main class="page-content" aria-label="Content">
|
||||
<div class="w">
|
||||
{{- block "main" . }}{{- end }}
|
||||
{{ partial "footer.html" }}
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
||||
8
Hugo/themes/nostyleplease/layouts/_default/list.html
Normal file
8
Hugo/themes/nostyleplease/layouts/_default/list.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "back_link.html" .}}
|
||||
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ .Content }}
|
||||
{{ partial "post_list.html" (dict "context" . "section" .Section)}}
|
||||
{{ end }}
|
||||
21
Hugo/themes/nostyleplease/layouts/_default/single.html
Normal file
21
Hugo/themes/nostyleplease/layouts/_default/single.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "back_link.html" .}}
|
||||
|
||||
<article>
|
||||
<p class="post-meta">
|
||||
<time datetime="{{ .Date }}">
|
||||
{{ .Date | time.Format site.Params.theme_config.date_format }}
|
||||
</time>
|
||||
</p>
|
||||
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ if .Params.toc }}
|
||||
<aside {{ if .Params.tocBorder }} class="toc" {{ end }}>
|
||||
{{ .TableOfContents }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
|
||||
{{ .Content }}
|
||||
</article>
|
||||
{{ end }}
|
||||
8
Hugo/themes/nostyleplease/layouts/_default/taxonomy.html
Normal file
8
Hugo/themes/nostyleplease/layouts/_default/taxonomy.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "back_link.html" .}}
|
||||
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ .Content }}
|
||||
{{ partial "post_list.html" (dict "context" .)}}
|
||||
{{ end }}
|
||||
8
Hugo/themes/nostyleplease/layouts/_default/term.html
Normal file
8
Hugo/themes/nostyleplease/layouts/_default/term.html
Normal file
@@ -0,0 +1,8 @@
|
||||
{{ define "main" }}
|
||||
{{ partial "back_link.html" .}}
|
||||
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ .Content }}
|
||||
{{ partial "post_list.html" (dict "context" .)}}
|
||||
{{ end }}
|
||||
1
Hugo/themes/nostyleplease/layouts/footer.md
Normal file
1
Hugo/themes/nostyleplease/layouts/footer.md
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
12
Hugo/themes/nostyleplease/layouts/index.html
Normal file
12
Hugo/themes/nostyleplease/layouts/index.html
Normal file
@@ -0,0 +1,12 @@
|
||||
{{ define "main" }}
|
||||
|
||||
<header>
|
||||
<h1>{{ $.Site.Title }}</h1>
|
||||
{{- if $.Site.Params.theme_config.show_description -}}
|
||||
<p>{{ $.Site.Params.description }}</p>
|
||||
{{- end -}}
|
||||
</header>
|
||||
{{ .Content }}
|
||||
{{ partial "menu_item.html" (dict "context" . "collection" $.Site.Data.menu.entries) }}
|
||||
|
||||
{{ end }}
|
||||
@@ -0,0 +1 @@
|
||||
<a href="{{ "" | relURL }}">{{ $.Site.Params.theme_config.back_home_text }}</a>
|
||||
11
Hugo/themes/nostyleplease/layouts/partials/footer.html
Normal file
11
Hugo/themes/nostyleplease/layouts/partials/footer.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{{ if site.Params.theme_config.isShowFooter }}
|
||||
{{ $footerContent := readFile "layouts/footer.md" }}
|
||||
{{ if and $footerContent (ne $footerContent "") }}
|
||||
{{ $footerContent | markdownify }}
|
||||
{{ else }}
|
||||
{{ warnf "layouts/footer.md file is not found or empty. Falling back to default footer." }}
|
||||
<footer class="site-footer">
|
||||
<p>© {{ now.Format "2006" }} {{ site.Title }}</p>
|
||||
</footer>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
22
Hugo/themes/nostyleplease/layouts/partials/head.html
Normal file
22
Hugo/themes/nostyleplease/layouts/partials/head.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
{{ if .IsPage }} <meta name="description" content="{{ .Summary }}"> {{ end }}
|
||||
|
||||
<title>
|
||||
{{ if not .IsHome }}
|
||||
{{ .Title }}
|
||||
{{ else }}
|
||||
{{ $.Site.Title }}
|
||||
{{ end }}
|
||||
</title>
|
||||
|
||||
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{{ $.Site.Params.favicon | relURL }}" />
|
||||
{{ $options := (dict "outputStyle" "compressed" "enableSourceMap" (not hugo.IsProduction)) }}
|
||||
{{ $sass := resources.Get "css/main.scss" }}
|
||||
{{ $style := $sass | css.Sass $options | resources.Fingerprint "sha512" }}
|
||||
<link rel="stylesheet" href="{{ $style.Permalink | relURL }}" integrity="{{ $style.Data.Integrity }}" />
|
||||
{{ if .Params.mathjax }} {{ partial "mathjax.html" . }} {{ end }}
|
||||
</head>
|
||||
21
Hugo/themes/nostyleplease/layouts/partials/mathjax.html
Normal file
21
Hugo/themes/nostyleplease/layouts/partials/mathjax.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<script>
|
||||
MathJax = {
|
||||
tex: {
|
||||
inlineMath: [['$', '$'], ['\\(', '\\)']],
|
||||
displayMath: [['$$','$$'], ['\\[', '\\]']],
|
||||
processEscapes: true,
|
||||
processEnvironments: true
|
||||
},
|
||||
options: {
|
||||
skipHtmlTags: ['script', 'noscript', 'style', 'textarea', 'pre']
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('load', (event) => {
|
||||
document.querySelectorAll("mjx-container").forEach(function(x){
|
||||
x.parentElement.classList += 'has-jax'})
|
||||
});
|
||||
|
||||
</script>
|
||||
<script src="https://cdnjs.cloudflare.com/polyfill/v3/polyfill.min.js?features=es6"></script>
|
||||
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
||||
19
Hugo/themes/nostyleplease/layouts/partials/menu_item.html
Normal file
19
Hugo/themes/nostyleplease/layouts/partials/menu_item.html
Normal file
@@ -0,0 +1,19 @@
|
||||
<ul>
|
||||
{{- range $item := .collection -}}
|
||||
<li>
|
||||
{{- with $item.url -}}
|
||||
<a href="{{ $item.url | relURL }}">{{ safeHTML $item.title }}</a>
|
||||
{{- else -}}
|
||||
{{ safeHTML $item.title }}
|
||||
{{- end -}}
|
||||
</li>
|
||||
|
||||
{{- if $item.entries }}
|
||||
{{ partial "menu_item.html" (dict "context" . "collection" $item.entries) }}
|
||||
{{- end -}}
|
||||
|
||||
{{- if $item.post_list -}}
|
||||
{{ partial "post_list.html" (dict "context" . "section" $item.post_list.section "limit" $item.post_list.limit "show_more" $item.post_list.show_more "show_more_text" $item.post_list.show_more_text "show_more_url" $item.post_list.show_more_url) -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</ul>
|
||||
39
Hugo/themes/nostyleplease/layouts/partials/post_list.html
Normal file
39
Hugo/themes/nostyleplease/layouts/partials/post_list.html
Normal file
@@ -0,0 +1,39 @@
|
||||
{{- $posts := "" -}}
|
||||
|
||||
{{- if .section -}}
|
||||
{{- $posts = (where site.RegularPages "Section" .section) -}}
|
||||
{{- else -}}
|
||||
{{- if (eq .context.Kind "taxonomy") -}}
|
||||
{{- $posts = .context.Pages -}}
|
||||
{{- else -}}
|
||||
{{- if (eq .context.Kind "term") -}}
|
||||
{{- $posts = .context.Data.Pages -}}
|
||||
{{- else -}}
|
||||
{{- $posts = site.RegularPages }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $limit_exceeded:= "" -}}
|
||||
{{- if (and .limit (gt (len $posts) .limit)) -}}
|
||||
{{- $limit_exceeded = true -}}
|
||||
{{- else -}}
|
||||
{{- $limit_exceeded = false -}}
|
||||
{{ end }}
|
||||
|
||||
{{- if (gt (len $posts) 0) }}
|
||||
{{- if .limit }}
|
||||
{{ $posts = (first .limit $posts ) }}
|
||||
{{ end }}
|
||||
<ul>
|
||||
{{- range $post := $posts -}}
|
||||
<li>
|
||||
<span>{{- ($post.Date | time.Format site.Params.theme_config.date_format) }}</span>
|
||||
<a href="{{ $post.Permalink | relURL }}">{{ $post.Title }}</a>
|
||||
</li>
|
||||
{{ end }}
|
||||
{{- if and .show_more $limit_exceeded }}
|
||||
<li><a href="{{ .show_more_url | relURL }}">{{ .show_more_text | default "Show more..." }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
25
Hugo/themes/nostyleplease/layouts/posts/baseof.html
Normal file
25
Hugo/themes/nostyleplease/layouts/posts/baseof.html
Normal file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ $.Site.LanguageCode }}">
|
||||
{{- partial "head.html" . -}}
|
||||
<body a="{{ $.Site.Params.theme_config.appearance | default "auto" }}">
|
||||
<main class="page-content" aria-label="Content">
|
||||
<div class="w">
|
||||
<div class="post-meta">
|
||||
{{ partial "back_link.html" .}}
|
||||
<p>
|
||||
<time datetime="{{ .Date }}">
|
||||
{{ .Date | time.Format site.Params.theme_config.date_format }}
|
||||
</time>
|
||||
</p>
|
||||
</div>
|
||||
{{- block "main" . }}{{- end }}
|
||||
</div>
|
||||
</main>
|
||||
</body>
|
||||
{{- if .Params.custom_js -}}
|
||||
{{- range .Params.custom_js -}}
|
||||
{{ $js := resources.Get (print "js/" . ".js") }}
|
||||
<script type="text/javascript" src="{{ $js.RelPermalink }}"></script>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
</html>
|
||||
21
Hugo/themes/nostyleplease/layouts/posts/list.html
Normal file
21
Hugo/themes/nostyleplease/layouts/posts/list.html
Normal file
@@ -0,0 +1,21 @@
|
||||
{{ define "main" }}
|
||||
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ .Content }}
|
||||
|
||||
<!-- divide post list by year -->
|
||||
{{ if .Site.Params.theme_config.isListGroupByDate }}
|
||||
{{ range .Pages.GroupByDate "2006 Year" }}
|
||||
<p>{{ .Key }}</p>
|
||||
<ul>
|
||||
{{ range .Pages }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
{{ partial "post_list.html" (dict "context" . "section" .Section)}}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
14
Hugo/themes/nostyleplease/layouts/posts/single.html
Normal file
14
Hugo/themes/nostyleplease/layouts/posts/single.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{{ define "main" }}
|
||||
|
||||
<article>
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ if .Params.toc }}
|
||||
<aside {{ if .Params.tocBorder }} class="toc" {{ end }}>
|
||||
{{ .TableOfContents }}
|
||||
</aside>
|
||||
{{ end }}
|
||||
|
||||
{{ .Content }}
|
||||
</article>
|
||||
{{ end }}
|
||||
@@ -0,0 +1,6 @@
|
||||
<details {{ if eq (.Get "open" | default "false") "true" }}open{{ end }}>
|
||||
<summary>
|
||||
{{ .Get "summary" | default "Details:" }}
|
||||
</summary>
|
||||
{{ .Inner | markdownify }}
|
||||
</details>
|
||||
3
Hugo/themes/nostyleplease/layouts/shortcodes/texd.html
Normal file
3
Hugo/themes/nostyleplease/layouts/shortcodes/texd.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<span>
|
||||
$${{ .Get 0 }}$$
|
||||
</span>
|
||||
3
Hugo/themes/nostyleplease/layouts/shortcodes/texi.html
Normal file
3
Hugo/themes/nostyleplease/layouts/shortcodes/texi.html
Normal file
@@ -0,0 +1,3 @@
|
||||
<span>
|
||||
\({{ .Get 0 }}\)
|
||||
</span>
|
||||
BIN
Hugo/themes/nostyleplease/logo.png
Normal file
BIN
Hugo/themes/nostyleplease/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 474 B |
21
Hugo/themes/nostyleplease/theme.toml
Normal file
21
Hugo/themes/nostyleplease/theme.toml
Normal file
@@ -0,0 +1,21 @@
|
||||
# theme.toml template for a Hugo theme
|
||||
# See https://github.com/gohugoio/hugoThemes#themetoml for an example
|
||||
|
||||
name = "no-style-please"
|
||||
license = "MIT"
|
||||
licenselink = "https://github.com/Masellum/hugo-theme-nostyleplease/blob/main/LICENSE"
|
||||
description = "a (nearly) no-CSS, fast, minimalist Hugo theme ported from riggraz/no-style-please."
|
||||
homepage = "https://github.com/Masellum/hugo-theme-nostyleplease"
|
||||
tags = ["blog", "minimalist"]
|
||||
features = []
|
||||
min_version = "0.41.0"
|
||||
|
||||
[author]
|
||||
name = "Masellum"
|
||||
homepage = "Masellum.github.io"
|
||||
|
||||
# If porting an existing theme
|
||||
[original]
|
||||
name = "riggraz"
|
||||
homepage = "https://riggraz.dev/"
|
||||
repo = "https://github.com/riggraz/no-style-please"
|
||||
Reference in New Issue
Block a user