diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2024-08-10 21:03:16 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2024-08-10 21:03:16 -0500 |
commit | f49d28caa3005c608eec9f8f82b1d9625ae37c01 (patch) | |
tree | 3538601cd4ac385e70517f6732290b09c806f936 | |
download | hugo-theme-tjkbasic-f49d28caa3005c608eec9f8f82b1d9625ae37c01.tar.xz hugo-theme-tjkbasic-f49d28caa3005c608eec9f8f82b1d9625ae37c01.zip |
initial commit
-rw-r--r-- | archetypes/default.md | 7 | ||||
-rw-r--r-- | hugo.yaml | 12 | ||||
-rw-r--r-- | layouts/_default/_markup/render-link.html | 1 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 32 | ||||
-rw-r--r-- | layouts/_default/list.html | 11 | ||||
-rw-r--r-- | layouts/_default/single.html | 20 | ||||
-rw-r--r-- | layouts/shortcodes/img.html | 34 | ||||
-rw-r--r-- | static/icons/rss_feed_24dp_78A75A_FILL0_wght400_GRAD0_opsz24.svg | 1 | ||||
-rw-r--r-- | static/stylesheets/highlight.css | 86 | ||||
-rw-r--r-- | static/stylesheets/style.css | 139 | ||||
-rw-r--r-- | theme.yaml | 6 |
11 files changed, 349 insertions, 0 deletions
diff --git a/archetypes/default.md b/archetypes/default.md new file mode 100644 index 0000000..afad1c3 --- /dev/null +++ b/archetypes/default.md @@ -0,0 +1,7 @@ +--- +title: "{{ replace .Name "-" " " | title }}" +date: {{ .Date }} +categories: [ ] +tags: [ ] +--- + diff --git a/hugo.yaml b/hugo.yaml new file mode 100644 index 0000000..b1e16f9 --- /dev/null +++ b/hugo.yaml @@ -0,0 +1,12 @@ +menus: + main: + - name: About + pageRef: /about + - name: Contact + pageRef: /contact + +# TODO this doesnt work +markup: + highlight: + noClasses: false + lineNos: true diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..f04b2e3 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1 @@ +<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a> diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..e5b0ed0 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + {{ $title := print .Title " - " .Site.Title }} + {{ if .IsHome }}{{ $title = .Site.Title }}{{ end }} + <title>{{ $title | title }}</title> + <link rel="stylesheet" type="text/css" href="/stylesheets/highlight.css"> + <link rel="stylesheet" type="text/css" href="/stylesheets/style.css"> + {{- block "head" . }}{{- end }} + </head> + <body> + <header> + <a id="homelink" href="/">{{ .Site.Title }}</a> + <span id="title">{{ .Title }}</span> + <div id="menu"> + {{- range site.Menus.main }} + <a href="{{ .URL }}">{{ .Name }}</a> + {{- end }} + </div> + </header> + <main> + {{- block "main" . }}{{- end }} + </main> + <footer> + <hr> + <div id="sharing"> + <a><img src="/icons/rss_feed_24dp_78A75A_FILL0_wght400_GRAD0_opsz24.svg" /></a> + </div> + <span id="copyright">© Tim Keller 2024</span> + </footer> + </body> +</html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..06b99a2 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,11 @@ +{{ define "main" }} + +{{ .Content }} + +<ul> + {{ range .Pages.ByPublishDate.Reverse }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} +</ul> + +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..099d3fc --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,20 @@ +{{ define "main" }} + +<div id="publishing"> + <span>{{ .PublishDate | time.Format ":date_long" }}</span> + {{ if and (isset .Params "lastmod") (ne .Lastmod .PublishDate) }} + <br> + <span>Revised: {{ .Lastmod | time.Format ":date_long" }}</span> + {{ end }} + {{ if isset .Params "tags" }} + <br> + <span>Tags:</span> + {{- range sort .Params.tags }} + <a href="/tags/{{ . }}">{{ . | humanize | title }}</a> + {{- end }} + {{ end }} +</div> + +{{ .Content }} + +{{ end }} diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html new file mode 100644 index 0000000..65ca44f --- /dev/null +++ b/layouts/shortcodes/img.html @@ -0,0 +1,34 @@ +<!-- https://gohugo.io/content-management/image-processing/ --> + +<!-- Get image --> +{{ $image := resources.GetMatch (.Get "src") }} + +<!-- Get parameters --> +{{ $alt := .Get "alt" | default "" }} +{{ $rotation := .Get "rotation" | default 0 }} + +<!-- Get quality --> +{{ $quality := .Get "quality" | default "original" }} + +{{ $q := 0 }} +{{ $size := 0 }} +{{ if eq $quality "low" }} + {{ $q = 60 }} + {{ $size = 600 }} +{{ else if eq $quality "medium" }} + {{ $q = 75 }} + {{ $size = 1000 }} +{{ else if eq $quality "high" }} + {{ $q = 90 }} + {{ $size = 1200 }} +{{ end }} + + +<!-- Make image --> +{{ if ne $quality "original" }} + {{ $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) }} +{{ end }} +<figure> + <img src="{{ $image.RelPermalink }}" title="{{ $alt }}" alt="{{ $alt }}" /> + <figcaption>{{ $alt }}</figcaption> +</figure> diff --git a/static/icons/rss_feed_24dp_78A75A_FILL0_wght400_GRAD0_opsz24.svg b/static/icons/rss_feed_24dp_78A75A_FILL0_wght400_GRAD0_opsz24.svg new file mode 100644 index 0000000..01addb0 --- /dev/null +++ b/static/icons/rss_feed_24dp_78A75A_FILL0_wght400_GRAD0_opsz24.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#78A75A"><path d="M200-120q-33 0-56.5-23.5T120-200q0-33 23.5-56.5T200-280q33 0 56.5 23.5T280-200q0 33-23.5 56.5T200-120Zm480 0q0-117-44-218.5T516-516q-76-76-177.5-120T120-680v-120q142 0 265 53t216 146q93 93 146 216t53 265H680Zm-240 0q0-67-25-124.5T346-346q-44-44-101.5-69T120-440v-120q92 0 171.5 34.5T431-431q60 60 94.5 139.5T560-120H440Z"/></svg>
\ No newline at end of file diff --git a/static/stylesheets/highlight.css b/static/stylesheets/highlight.css new file mode 100644 index 0000000..0c15e1b --- /dev/null +++ b/static/stylesheets/highlight.css @@ -0,0 +1,86 @@ +/* Background */ .bg { color: #ebdbb2; background-color: #282828; } +/* PreWrapper */ .chroma { color: #ffffff; background-color: #282828; } +/* Other */ .chroma .x { } +/* Error */ .chroma .err { } +/* CodeLine */ .chroma .cl { } +/* LineLink */ .chroma .lnlinks { outline: none; text-decoration: none; color: inherit } +/* LineTableTD */ .chroma .lntd { vertical-align: top; padding: 0; margin: 0; border: 0; } +/* LineTable */ .chroma .lntable { border-spacing: 0; padding: 0; margin: 0; border: 0; } +/* LineHighlight */ .chroma .hl { background-color: #3d3d3d } +/* LineNumbersTable */ .chroma .lnt { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #756d59 } +/* LineNumbers */ .chroma .ln { white-space: pre; -webkit-user-select: none; user-select: none; margin-right: 0.4em; padding: 0 0.4em 0 0.4em;color: #756d59 } +/* Line */ .chroma .line { display: flex; } +/* Keyword */ .chroma .k { color: #fb4934 } +/* KeywordConstant */ .chroma .kc { color: #fb4934 } +/* KeywordDeclaration */ .chroma .kd { color: #fb4934 } +/* KeywordNamespace */ .chroma .kn { color: #fb4934 } +/* KeywordPseudo */ .chroma .kp { color: #fb4934 } +/* KeywordReserved */ .chroma .kr { color: #fb4934 } +/* KeywordType */ .chroma .kt { color: #fabd2f } +/* Name */ .chroma .n { } +/* NameAttribute */ .chroma .na { color: #b8bb26; font-weight: bold } +/* NameBuiltin */ .chroma .nb { color: #fabd2f } +/* NameBuiltinPseudo */ .chroma .bp { } +/* NameClass */ .chroma .nc { } +/* NameConstant */ .chroma .no { color: #d3869b } +/* NameDecorator */ .chroma .nd { } +/* NameEntity */ .chroma .ni { color: #fabd2f } +/* NameException */ .chroma .ne { color: #fb8019 } +/* NameFunction */ .chroma .nf { color: #fabd2f } +/* NameFunctionMagic */ .chroma .fm { } +/* NameLabel */ .chroma .nl { color: #fb8019 } +/* NameNamespace */ .chroma .nn { } +/* NameOther */ .chroma .nx { } +/* NameProperty */ .chroma .py { } +/* NameTag */ .chroma .nt { color: #fb8019 } +/* NameVariable */ .chroma .nv { } +/* NameVariableClass */ .chroma .vc { } +/* NameVariableGlobal */ .chroma .vg { } +/* NameVariableInstance */ .chroma .vi { } +/* NameVariableMagic */ .chroma .vm { } +/* Literal */ .chroma .l { } +/* LiteralDate */ .chroma .ld { } +/* LiteralString */ .chroma .s { color: #b8bb26 } +/* LiteralStringAffix */ .chroma .sa { color: #b8bb26 } +/* LiteralStringBacktick */ .chroma .sb { color: #b8bb26 } +/* LiteralStringChar */ .chroma .sc { color: #b8bb26 } +/* LiteralStringDelimiter */ .chroma .dl { color: #b8bb26 } +/* LiteralStringDoc */ .chroma .sd { color: #b8bb26 } +/* LiteralStringDouble */ .chroma .s2 { color: #b8bb26 } +/* LiteralStringEscape */ .chroma .se { color: #b8bb26 } +/* LiteralStringHeredoc */ .chroma .sh { color: #b8bb26 } +/* LiteralStringInterpol */ .chroma .si { color: #b8bb26 } +/* LiteralStringOther */ .chroma .sx { color: #b8bb26 } +/* LiteralStringRegex */ .chroma .sr { color: #b8bb26 } +/* LiteralStringSingle */ .chroma .s1 { color: #b8bb26 } +/* LiteralStringSymbol */ .chroma .ss { color: #83a598 } +/* LiteralNumber */ .chroma .m { color: #d3869b } +/* LiteralNumberBin */ .chroma .mb { color: #d3869b } +/* LiteralNumberFloat */ .chroma .mf { color: #d3869b } +/* LiteralNumberHex */ .chroma .mh { color: #d3869b } +/* LiteralNumberInteger */ .chroma .mi { color: #d3869b } +/* LiteralNumberIntegerLong */ .chroma .il { color: #d3869b } +/* LiteralNumberOct */ .chroma .mo { color: #d3869b } +/* Operator */ .chroma .o { color: #fb4934 } +/* OperatorWord */ .chroma .ow { color: #fb4934 } +/* Punctuation */ .chroma .p { } +/* Comment */ .chroma .c { color: #928374; font-style: italic } +/* CommentHashbang */ .chroma .ch { color: #928374; font-style: italic } +/* CommentMultiline */ .chroma .cm { color: #928374; font-style: italic } +/* CommentSingle */ .chroma .c1 { color: #928374; font-style: italic } +/* CommentSpecial */ .chroma .cs { color: #928374; font-style: italic } +/* CommentPreproc */ .chroma .cp { color: #8ec07c } +/* CommentPreprocFile */ .chroma .cpf { color: #8ec07c; font-style: italic } +/* Generic */ .chroma .g { } +/* GenericDeleted */ .chroma .gd { color: #282828; background-color: #fb8019 } +/* GenericEmph */ .chroma .ge { color: #83a598; text-decoration: underline } +/* GenericError */ .chroma .gr { background-color: #fb8019; font-weight: bold } +/* GenericHeading */ .chroma .gh { color: #b8bb26; font-weight: bold } +/* GenericInserted */ .chroma .gi { color: #282828; background-color: #b8bb26 } +/* GenericOutput */ .chroma .go { color: #504945 } +/* GenericPrompt */ .chroma .gp { } +/* GenericStrong */ .chroma .gs { } +/* GenericSubheading */ .chroma .gu { color: #b8bb26; font-weight: bold } +/* GenericTraceback */ .chroma .gt { background-color: #fb8019; font-weight: bold } +/* GenericUnderline */ .chroma .gl { } +/* TextWhitespace */ .chroma .w { } diff --git a/static/stylesheets/style.css b/static/stylesheets/style.css new file mode 100644 index 0000000..0765af0 --- /dev/null +++ b/static/stylesheets/style.css @@ -0,0 +1,139 @@ +html { + background: #222; +} +body { + margin: 0 0 1.5em 0; + color: white; +} + +header { + display: grid; + grid-template-columns: 1fr auto 1fr; + background: #333; + padding: 5px 10px; + gap: 1em; + user-select: none; +} + +#title { + text-align: center; +} + +#menu { + margin-left: auto; + display: flex; + gap: 3ex; +} + +header a { + color: white; + text-decoration: none; + position: relative; + width: fit-content; +} + +header a:hover::after { + content: ""; + background: green; + position: absolute; + display: block; + bottom: -.3em; + left: -1ex; + height: 3px; + width: calc(100% + 2ex); +} + +main, footer{ + max-width: 900px; + margin: 1.5em auto; + padding-inline: 3ex; +} + +#publishing { + text-align: right; + color: #555; +} +#publishing a { + color: #555; +} + +hr { + color: #727272; +} + +h1, h2, h3, h4, h5, h6 { + text-align: center; +} + +.monodate { + font-family: monospace; +} + +a { + color: lightgreen; +} + +/* highlighted code */ +.chroma { + overflow: scroll; + background: none; +} + +.chroma .lntable { + margin: auto; + width: fit-content; +} +.chroma code { + margin: 0 1ex; +} + +.chroma ::selection { + background: #444; +} + +:not(.chroma span)::selection { + background: green; + color: white; +} + +pre { + tab-size: 4; +} + +ol, ul, pre code { + margin: auto; + display: block; + width: fit-content; + max-width: 100%; +} + +img, figcaption { + margin: auto; + display: block; + width: fit-content; + max-width: 95%; + color: #ddd; +} + +#copyright { + text-align: center; + display: block; + opacity: .2; +} + +@media (max-width: 800px) { + header { + grid-template-columns: auto auto; + grid-template-areas: + "home quicklinks" + "title title" + ; + } + #title { + text-align: center; + display: block; + width: 100%; + order: 3; + grid-area: title; + } +} diff --git a/theme.yaml b/theme.yaml new file mode 100644 index 0000000..b5c5201 --- /dev/null +++ b/theme.yaml @@ -0,0 +1,6 @@ +name: TJK Basic +license: MIT +homepage: tjkeller.xyz/projects/site/theme +author: + name: Tim Keller + homepage: tjkeller.xyz |