added crossorigin anonymous, resizing for large images, and ko-fi button

This commit is contained in:
kimcc 2020-04-13 09:01:36 -05:00
parent 9ec04a2978
commit 18f05635bf
11 changed files with 328 additions and 254 deletions

View File

@ -27,6 +27,28 @@ git clone https://github.com/kimcc/hugo-theme-noteworthy.git themes/noteworthy
Refer to the [Hugo docs](https://gohugo.io/getting-started/quick-start/) for more information. Refer to the [Hugo docs](https://gohugo.io/getting-started/quick-start/) for more information.
## Image shortcode for large images
To add images using the resize-image shortcode included with this theme, you will need to create a [Post Bundle](https://gohugo.io/content-management/organization/#page-bundles). Create a folder for your post, put your Markdown file and images inside, and rename your Markdown file `index.md`. For example:
```
my-new-post
- index.md
- image1.jpg
- image2.png
```
Then, you can add an image within your Markdown file by using the shortcode like thist:
```
{{< resize-image src="image1.jpg" alt="My first image" >}}
```
Add captions like this:
```
{{< resize-image src="image2.png" alt="My second image" caption="My caption" >}}
```
## Social media accounts ## Social media accounts
@ -77,6 +99,17 @@ disqusShortname = ""
googleAnalytics = "" googleAnalytics = ""
``` ```
## Ko-fi donation button
If you'd like to enable a Ko-fi button on your posts, enable it in the config file and add your identifier.
```
# Set enableKofi to true to enable the Ko-fi support button. Add your Ko-fi
ID to link to your account.
enableKofi = true
kofi = ""
```
## License ## License

View File

@ -29,42 +29,42 @@ $code: Menlo,Monaco,"Courier New",monospace;
html, html,
body { body {
height: 100%; height: 100%;
} }
html { html {
margin: 0; margin: 0;
line-height: 170%; line-height: 170%;
-ms-overflow-style: -ms-autohiding-scrollbar; -ms-overflow-style: -ms-autohiding-scrollbar;
} }
body { body {
color: $gray-dark; color: $gray-dark;
font-family: $sans-serif; font-family: $sans-serif;
margin: 0; margin: 0;
font-size: 1.1rem; font-size: 1.1rem;
} }
// TEXT // TEXT
article p { article p {
a { a {
text-decoration: underline; text-decoration: underline;
text-decoration-skip-ink: auto; text-decoration-skip-ink: auto;
color: $gray-dark; color: $gray-dark;
} }
} }
article .post-footer>a { article .post-footer>a {
text-decoration: none; text-decoration: none;
} }
h1 { h1 {
font-size: 1.9em; font-size: 1.9em;
padding-top: 0.2em; padding-top: 0.2em;
margin: 0.5em 0em 0.75em 0em; margin: 0.5em 0em 0.75em 0em;
font-family: $serif; font-family: $serif;
font-weight: 600; font-weight: 600;
line-height: 1.3em; line-height: 1.3em;
} }
h2, h2,
@ -72,422 +72,435 @@ h3,
h4, h4,
h5, h5,
h6 { h6 {
margin: 1.25em 0em 0.75em 0em; margin: 1.25em 0em 0.75em 0em;
font-family: $serif; font-family: $serif;
font-weight: 600; font-weight: 600;
} }
h2 { h2 {
font-size: 1.25em; font-size: 1.25em;
line-height: 1.4em; line-height: 1.4em;
a { a {
text-decoration: none; text-decoration: none;
position: relative; position: relative;
text-shadow: 0px -2px 0 white, 0px -1px 0 white, 0px 0px 0 white, 2px -2px 0 white, 2px -1px 0 white, 2px 0px 0 white, -2px -2px 0 white, -2px -1px 0 white, -2px 0px 0 white, 1px -2px 0 white, 1px -1px 0 white, 1px 0px 0 white, -1px -2px 0 white, -1px -1px 0 white, -1px 0px 0 white, 0px -2px 0 white, 0px -1px 0 white, 0px 0px 0 white; text-shadow: 0px -2px 0 white, 0px -1px 0 white, 0px 0px 0 white, 2px -2px 0 white, 2px -1px 0 white, 2px 0px 0 white, -2px -2px 0 white, -2px -1px 0 white, -2px 0px 0 white, 1px -2px 0 white, 1px -1px 0 white, 1px 0px 0 white, -1px -2px 0 white, -1px -1px 0 white, -1px 0px 0 white, 0px -2px 0 white, 0px -1px 0 white, 0px 0px 0 white;
box-shadow: 0 -1px 0 0 white inset, 0 -2px 0 0 transparent inset; box-shadow: 0 -1px 0 0 white inset, 0 -2px 0 0 transparent inset;
background-size: 1px 1em; background-size: 1px 1em;
position: relative; position: relative;
transition: all 0.6s cubic-bezier(0.075, 0.82, 0.165, 1); transition: all 0.6s cubic-bezier(0.075, 0.82, 0.165, 1);
&:hover { &:hover {
box-shadow: 0 -1px 0 0 white inset, 0 -2px 0 0 $gray-dark inset; box-shadow: 0 -1px 0 0 white inset, 0 -2px 0 0 $gray-dark inset;
transition: all 1s cubic-bezier(0.075, 0.82, 0.165, 1); transition: all 1s cubic-bezier(0.075, 0.82, 0.165, 1);
}
} }
}
} }
h5, h5,
h6 { h6 {
font-weight: 700; font-weight: 700;
line-height: 1.3em; line-height: 1.3em;
} }
h4 { h4 {
line-height: 1.3em; line-height: 1.3em;
} }
h3 { h3 {
font-size: 1.1em; font-size: 1.1em;
line-height: 1.3em; line-height: 1.3em;
} }
p { p {
margin: 0em 0 1em 0; margin: 0em 0 1em 0;
} }
// LINKS AND TAGS // LINKS AND TAGS
a { a {
text-decoration: underline; text-decoration: underline;
text-decoration-skip-ink: auto; text-decoration-skip-ink: auto;
color: $gray-dark; color: $gray-dark;
} }
a, a,
a>svg { a>svg {
transition: 0.1s cubic-bezier(0.075, 0.82, 0.165, 1); transition: 0.1s cubic-bezier(0.075, 0.82, 0.165, 1);
} }
a:visited { a:visited {
color: $gray-dark; color: $gray-dark;
} }
.color-link { .color-link {
text-decoration: none; text-decoration: none;
color: $teal; color: $teal;
font-family: $sans-serif; font-family: $sans-serif;
margin-right: 1.5em; margin-right: 1.5em;
} }
.color-link:visited { .color-link:visited {
color: $teal; color: $teal;
} }
.color-link:hover { .color-link:hover {
color: $teal-darker; color: $teal-darker;
.color-arrow { .color-arrow {
fill: $teal-darker; fill: $teal-darker;
} }
} }
.tag { .tag {
margin-right: 0.75em; margin-right: 0.75em;
margin-bottom: 1em; margin-bottom: 1em;
line-height: 1.75em; line-height: 1.75em;
color: $gray-light; color: $gray-light;
} }
.tag:visited { .tag:visited {
color: $gray-light; color: $gray-light;
} }
.tag:hover { .tag:hover {
color: $gray-medium; color: $gray-medium;
} }
// ARTICLE FORMATTING // ARTICLE FORMATTING
time { time {
margin-right: 1.5em; margin-right: 1.5em;
color: $gray-light; color: $gray-light;
} }
hr { hr {
border: 0; border: 0;
height: 0; height: 0;
border-bottom: 1px solid $gray-lightest; border-bottom: 1px solid $gray-lightest;
} }
ul, ul,
ol { ol {
margin: 1em 0em; margin: 1em 0em;
padding-left: 2em; padding-left: 2em;
} }
li { li {
line-height: 150%; line-height: 150%;
} }
mark { mark {
background-color: $highlight; background-color: $highlight;
} }
blockquote { blockquote {
border-left: 4px solid $gray-lightest; border-left: 4px solid $gray-lightest;
padding-left: 1.3em; padding-left: 1.3em;
margin-left: 0em; margin-left: 0em;
margin-top: 0em; margin-top: 0em;
p { p {
margin-bottom: 0em; margin-bottom: 0em;
} }
} }
cite { cite {
font-size: 0.95em; font-size: 0.95em;
} }
pre { pre {
padding: 1em; padding: 1em;
background-color: $gray-background; background-color: $gray-background;
max-width: 100%; max-width: 100%;
overflow: scroll; overflow: scroll;
} }
p code, p code,
kbd { kbd {
font-size: 0.95rem; font-size: 0.95rem;
background: $gray-background; background: $gray-background;
padding: 0.2em; padding: 0.2em;
} }
code, code,
pre, pre,
kbd { kbd {
font-family: $code; font-family: $code;
font-size: 0.95rem; font-size: 0.95rem;
line-height: 154%; line-height: 154%;
} }
.table-wrapper { .table-wrapper {
overflow-x: auto; overflow-x: auto;
} }
table { table {
max-width: 100%; max-width: 100%;
border-spacing: 0; border-spacing: 0;
thead { thead {
background: $gray-background; background: $gray-background;
} }
th, th,
td { td {
padding: 0.5em 1em; padding: 0.5em 1em;
border: 1px double $gray-table-border; border: 1px double $gray-table-border;
} }
} }
// TOP NAV // TOP NAV
nav { nav {
padding: 0.25em 1.5em 1em 1.5em; padding: 0.25em 1.5em 1em 1.5em;
max-width: 100%; max-width: 100%;
} }
.site-title { .site-title {
margin: 1.5em 0em 1em 0em; margin: 1.5em 0em 1em 0em;
text-align: center; text-align: center;
line-height: 1.7em; line-height: 1.7em;
a { a {
font-family: $serif; font-family: $serif;
font-size: 1.5em; font-size: 1.5em;
text-decoration: none; text-decoration: none;
margin-top: 0.75em; margin-top: 0.75em;
} }
} }
.nav-menu { .nav-menu {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
flex-wrap: wrap; flex-wrap: wrap;
} }
.nav-link { .nav-link {
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
.description { .description {
font-style: italic; font-style: italic;
color: $gray-medium; color: $gray-medium;
text-align: center; text-align: center;
margin-bottom: 3.7em; margin-bottom: 3.7em;
margin-top: -0.75em; margin-top: -0.75em;
} }
// CONTENT // CONTENT
.content-container { .content-container {
padding: 0.5em 1.5em 0em 1.5em; padding: 0.5em 1.5em 0em 1.5em;
margin: 0em; margin: 0em;
max-width: 100%; max-width: 100%;
} }
.paginator { .paginator {
flex-shrink: 0; flex-shrink: 0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: flex-end; align-items: flex-end;
margin-top: 1em; margin-top: 1em;
padding-bottom: 1.5em; padding-bottom: 1.5em;
align-items: center; align-items: center;
.older { .older {
margin-left: 1em; margin-left: 1em;
} }
p { p {
font-size: 0.95rem; font-size: 0.95rem;
margin: 0px; margin: 0px;
} }
a { a {
text-decoration: none; text-decoration: none;
color: $teal; color: $teal;
font-size: 0.95rem; font-size: 0.95rem;
} }
} }
// ARTICLE CONTENT // ARTICLE CONTENT
.article-content { .article-content {
flex: 1 0 auto; flex: 1 0 auto;
}
.article-figure {
margin: 0 0 1em;
}
.article-image {
max-width: 100%;
margin: 0 0 1em;
} }
.canon { .canon {
width: 100%; width: 100%;
height: auto; height: auto;
} }
.footnote-ref { .footnote-ref {
a { a {
margin-left: 0.3em; margin-left: 0.3em;
} }
a::before { a::before {
content: "["; content: "[";
} }
a::after { a::after {
content: "]"; content: "]";
} }
} }
.emojify { .emojify {
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols; font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
font-size: 1.5rem; font-size: 1.5rem;
vertical-align: middle; vertical-align: middle;
} }
// SHORTCODE CONTENT // SHORTCODE CONTENT
.twitter-tweet { .twitter-tweet {
font-family: $sans-serif !important; font-family: $sans-serif !important;
border-left: 4px solid $teal !important; border-left: 4px solid $teal !important;
color: $gray-dark !important;
font-size: 1rem !important;
font-style: italic !important;
margin-left: 0em;
padding-left: 1.3em !important;
p {
font-size: 1.1em;
font-style: normal;
margin-bottom: 1em;
line-height: 155%;
}
a {
color: $gray-dark !important; color: $gray-dark !important;
text-decoration: underline !important; font-size: 1rem !important;
} font-style: italic !important;
margin-left: 0em;
padding-left: 1.3em !important;
a:hover, p {
a:focus { font-size: 1.1em;
text-decoration: underline !important; font-style: normal;
} margin-bottom: 1em;
line-height: 155%;
}
a {
color: $gray-dark !important;
text-decoration: underline !important;
}
a:hover,
a:focus {
text-decoration: underline !important;
}
} }
.__h_instagram.card { .__h_instagram.card {
font-family: $sans-serif !important; font-family: $sans-serif !important;
font-size: 1.1em !important; font-size: 1.1em !important;
border: 1px solid $gray-light; border: 1px solid $gray-light;
margin-top: 1.2em !important; margin-top: 1.2em !important;
} }
// ARTICLE FOOTER // ARTICLE FOOTER
.kofi-button {
margin: 0.75em 0em 0.5em 0em;
}
.post-footer { .post-footer {
font-size: 0.95rem; font-size: 0.95rem;
color: $gray-light; color: $gray-light;
border-bottom: 1px solid $gray-lightest; border-bottom: 1px solid $gray-lightest;
padding-bottom: 1.8em; padding-bottom: 1.8em;
} }
.hidden { .hidden {
visibility: hidden; visibility: hidden;
border-bottom: 0px solid; border-bottom: 0px solid;
} }
.page-footer { .page-footer {
padding: 1.5em 0em 2em 0em; padding: 1.5em 0em 2em 0em;
font-size: 0.95rem; font-size: 0.95rem;
color: $gray-light;
a {
text-decoration: none;
color: $gray-light; color: $gray-light;
}
a {
text-decoration: none;
color: $gray-light;
}
} }
.footer-divider { .footer-divider {
color: $gray-lightest; color: $gray-lightest;
margin-bottom: 1.5em; margin-bottom: 1.5em;
} }
// ARCHIVES PAGE // ARCHIVES PAGE
.archives-list { .archives-list {
padding-left: 0em; padding-left: 0em;
} }
.archives-list-item { .archives-list-item {
display: flex; display: flex;
margin: 0.5em 0em; margin: 0.5em 0em;
} }
.archives-list-item-date { .archives-list-item-date {
width: 60px; width: 60px;
margin-right: 0.25em; margin-right: 0.25em;
color: $gray-light; color: $gray-light;
} }
// 404 PAGE // 404 PAGE
.not-found-title { .not-found-title {
margin-bottom: 0em; margin-bottom: 0em;
} }
// MAIN FOOTER // MAIN FOOTER
.footer { .footer {
visibility: hidden; visibility: hidden;
height: 0; height: 0;
} }
.footer-mobile { .footer-mobile {
margin-top: 2em; margin-top: 2em;
max-width: 100%; max-width: 100%;
padding: 0em 1.5em 0.75em 1.5em; padding: 0em 1.5em 0.75em 1.5em;
overflow: hidden; overflow: hidden;
.footer-mobile-links { .footer-mobile-links {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.divider-bar { .divider-bar {
color: $gray-light; color: $gray-light;
padding: 0em 0.25em; padding: 0em 0.25em;
} }
} }
footer { footer {
text-align: center; text-align: center;
.social-icons { .social-icons {
margin: 0 0 1.25em -.5em; margin: 0 0 1.25em -.5em;
} }
.social-icon { .social-icon {
padding: 0.3em 0.5em; padding: 0.3em 0.5em;
margin: 0.32em 0.1em; margin: 0.32em 0.1em;
display: inline-block; display: inline-block;
height: 2em; height: 2em;
position: relative; position: relative;
} }
.social-icon>svg:hover { .social-icon>svg:hover {
fill: $gray-medium; fill: $gray-medium;
} }
a { a {
text-decoration: none; text-decoration: none;
font-size: 0.95rem; font-size: 0.95rem;
color: $gray-light; color: $gray-light;
} }
a:visited { a:visited {
color: $gray-light; color: $gray-light;
} }
a:hover { a:hover {
color: $gray-medium; color: $gray-medium;
} }
} }
// BREAKPOINTS // BREAKPOINTS

View File

@ -27,6 +27,10 @@ disqusShortname = ""
# Blog description at the top of the homepage. Supports markdown. # Blog description at the top of the homepage. Supports markdown.
description = "Noteworthy is a minimalist Hugo theme, perfect for writers and bloggers." description = "Noteworthy is a minimalist Hugo theme, perfect for writers and bloggers."
# Set enableKofi to true to enable the Ko-fi support button. Add your Ko-fi ID to link to your account.
enableKofi = true
kofi = ""
# Add links to your accounts. Remove the ones you don't want to include. # Add links to your accounts. Remove the ones you don't want to include.
# Main # Main
email = "#" email = "#"

View File

@ -1,4 +1,5 @@
{{ define "main" }} {{ define "main" }}
<h1 class="post-title">{{ .Title }}</h1> <h1 class="post-title">{{ .Title }}</h1>
{{ if .Date }} {{ if .Date }}
<time>{{ .Date.Format "January 2, 2006" }}</time> <time>{{ .Date.Format "January 2, 2006" }}</time>
@ -10,6 +11,17 @@
</div> </div>
{{ template "_internal/disqus.html" . }} {{ template "_internal/disqus.html" . }}
{{ if .Site.Params.enableKofi }}
<script type='text/javascript' src='https://ko-fi.com/widgets/widget_2.js'></script>
<script type='text/javascript'>
const kofiId = '{{ .Site.Params.Kofi }}';
kofiwidget2.init('Support Me on Ko-fi', '#29abe0', kofiId);
kofiwidget2.draw();
</script>
{{ end }}
<div class="page-footer"> <div class="page-footer">
{{if .Params.tags}} {{if .Params.tags}}
<hr class="footer-divider"> <hr class="footer-divider">

View File

@ -8,5 +8,5 @@
</div> </div>
{{ $script := resources.Get "js/main.js" | minify | fingerprint -}} {{ $script := resources.Get "js/main.js" | minify | fingerprint -}}
<script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script> <script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
</footer> </footer>

View File

@ -5,5 +5,5 @@
<p><a href="https://gohugo.io" target="_blank" rel="noopener">Built with Hugo</a></p> <p><a href="https://gohugo.io" target="_blank" rel="noopener">Built with Hugo</a></p>
{{ $script := resources.Get "js/main.js" | minify | fingerprint -}} {{ $script := resources.Get "js/main.js" | minify | fingerprint -}}
<script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script> <script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }} crossorigin="anonymous"></script>
</footer> </footer>

View File

@ -30,4 +30,5 @@
{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} {{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
{{ end }} {{ end }}
{{ template "_internal/google_analytics.html" . }} {{ template "_internal/google_analytics.html" . }}
</head>
</head>

View File

@ -1,6 +1,6 @@
{{ if or .Page.Params.math .Site.Params.math }} {{ if or .Page.Params.math .Site.Params.math }}
<!-- KaTeX --> <!-- KaTeX -->
<link rel="stylesheet" type="text/css" href="{{ "css/katex.min.css" | relURL }}"> <link rel="stylesheet" type="text/css" href="{{ "css/katex.min.css" | relURL }}" crossorigin="anonymous">
<script type="text/javascript" src="{{ "js/katex.min.js" | relURL }}"></script> <script type="text/javascript" src="{{ "js/katex.min.js" | relURL }}" crossorigin="anonymous"></script>
<script type="text/javascript" src="{{ "js/auto-render.min.js" | relURL }}"onload="renderMathInElement(document.body);"></script> <script type="text/javascript" src="{{ "js/auto-render.min.js" | relURL }}"onload="renderMathInElement(document.body);" crossorigin="anonymous"></script>
{{ end }} {{ end }}

View File

@ -0,0 +1,11 @@
{{ $src := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
{{ if .Get "caption"}}
<figure class="article-figure">
{{ end }}
<img class="article-image" src="{{ $src.RelPermalink }}" {{ with .Get "alt" }}alt="{{.}}"{{ else }}alt=""{{ end }}>
{{ if .Get "caption"}}
<figcaption>{{ .Get "caption" }}</figcaption>
</figure>
{{ end }}

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"Target":"css/main.min.2545a1910010e26a9905276045afab868f812580a1e7482423da6c0c8c214d18.css","MediaType":"text/css","Data":{"Integrity":"sha256-JUWhkQAQ4mqZBSdgRa+rho+BJYCh50gkI9psDIwhTRg="}} {"Target":"css/main.min.975b1911c008aee6ab5fb42e51274b8268ebcb65dc15bd4a5f69b9eedb485c3e.css","MediaType":"text/css","Data":{"Integrity":"sha256-l1sZEcAIruarX7QuUSdLgmjry2XcFb1KX2m57ttIXD4="}}