diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..3599ba1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +--- +name: Build + +on: + - push + - pull_request + +jobs: + build: + runs-on: ubuntu-latest + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: + - uses: actions/checkout@v4 + with: + submodules: true + fetch-depth: 0 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v3 + with: + hugo-version: "0.135.0" + extended: true + + - name: Cache + uses: actions/cache@v4 + with: + path: /tmp/hugo_cache + key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-hugomod- + + - name: Build + run: hugo --minify diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..86c95ef --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Generated files by hugo +/public/ +/resources/_gen/ +/assets/jsconfig.json +hugo_stats.json + +# Executable may be added to repository +hugo.exe +hugo.darwin +hugo.linux + +# Temporary lock file while building +/.hugo_build.lock diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8aa2645 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) [year] [fullname] + +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. diff --git a/archetypes/default.md b/archetypes/default.md index fdccff8..c6f3fce 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,4 +1,5 @@ ---- -title: "{{ replace .Name "-" " " | title }}" -date: {{ .Date }} ---- ++++ +title = '{{ replace .File.ContentBaseName "-" " " | title }}' +date = {{ .Date }} +draft = true ++++ diff --git a/assets/css/main.css b/assets/css/main.css new file mode 100644 index 0000000..e0cc053 --- /dev/null +++ b/assets/css/main.css @@ -0,0 +1,84 @@ +:root { + --primary-color: #196680; + --secondary-color: #80dfff; + --alternative-color: #ff9b33; + --text-color: #222222; +} + +a { + color: var(--primary-color); +} + +.dark a { + color: var(--secondary-color); +} + +a:hover { + color: var(--alternative-color); +} + +h1, +h2, +h3 { + color: var(--primary-color); +} + +.dark h1, +.dark h2, +.dark h3 { + color: var(--secondary-color); +} + +.dark .pagination a { + color: var(--primary-color); +} + +body { + color: #222; + font-family: + Monaspace Argon, + sans-serif; + line-height: 1.5; + margin: 1rem; + max-width: 768px; +} + +header { + border-bottom: 1px solid #222; + margin-bottom: 1rem; +} + +footer { + border-top: 1px solid #222; + margin-top: 1rem; +} + +a { + color: #00e; + text-decoration: none; +} + +h1 { + font-family: + Optician Sans, + sans-serif; +} + +@font-face { + font-family: "Optician Sans"; + font-style: normal; + font-weight: 400; + src: url("/fonts/Optiker-K.woff") format("woff"); +} + +@font-face { + font-family: "Monaspace Radon"; + font-style: normal; + src: url("/fonts/MonaspaceRadon-Regular.woff") format("woff"); +} + +@font-face { + font-family: "Monaspace Argon"; + font-style: normal; + src: url("/fonts/MonaspaceArgon-Medium.woff") format("woff"); +} diff --git a/assets/js/main.js b/assets/js/main.js new file mode 100644 index 0000000..e2aac52 --- /dev/null +++ b/assets/js/main.js @@ -0,0 +1 @@ +console.log('This site was generated by Hugo.'); diff --git a/data/.gitkeep b/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md deleted file mode 100644 index 0e6a35a..0000000 --- a/exampleSite/content/_index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: "Home" ---- - -# Hi there - -Welcome to your new Hugo site. - -Now go build something great. diff --git a/exampleSite/content/about/index.md b/exampleSite/content/about/index.md deleted file mode 100644 index 6f5bcdb..0000000 --- a/exampleSite/content/about/index.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: "About" ---- - -Here's a bit about me. diff --git a/exampleSite/content/posts/my-first-post.md b/exampleSite/content/posts/my-first-post.md deleted file mode 100644 index bc12660..0000000 --- a/exampleSite/content/posts/my-first-post.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -title: "My First Post" -date: 2020-09-03T17:27:59+07:00 ---- - -Here's an example blog post. diff --git a/exampleSite/hugo.toml b/exampleSite/hugo.toml deleted file mode 100644 index 5e67390..0000000 --- a/exampleSite/hugo.toml +++ /dev/null @@ -1,16 +0,0 @@ -baseURL = "https://mynewhugosite.com" -title = "My New Hugo Site" -theme = "hugo-starter" - -[menu] - [[menu.main]] - identifier = "posts" - name = "Posts" - url = "/posts" - weight = 10 - - [[menu.main]] - identifier = "about" - name = "About" - url = "/about" - weight = 20 diff --git a/hugo.toml b/hugo.toml index 5e67390..6c35bc4 100644 --- a/hugo.toml +++ b/hugo.toml @@ -1,16 +1,23 @@ -baseURL = "https://mynewhugosite.com" -title = "My New Hugo Site" -theme = "hugo-starter" +baseURL = 'https://example.org/' +languageCode = 'en-US' +title = 'My New Hugo Site' -[menu] - [[menu.main]] - identifier = "posts" - name = "Posts" - url = "/posts" - weight = 10 +[[menus.main]] +name = 'Home' +pageRef = '/' +weight = 10 - [[menu.main]] - identifier = "about" - name = "About" - url = "/about" - weight = 20 +[[menus.main]] +name = 'Posts' +pageRef = '/posts' +weight = 20 + +[[menus.main]] +name = 'Tags' +pageRef = '/tags' +weight = 30 + +[module] + [module.hugoVersion] + extended = false + min = "0.116.0" diff --git a/i18n/.gitkeep b/i18n/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/layouts/404.html b/layouts/404.html deleted file mode 100644 index 9b100d8..0000000 --- a/layouts/404.html +++ /dev/null @@ -1,9 +0,0 @@ -{{ partial "header.html" . }} - -

Page Not Found

- -

This page doesn't exist.

- -

Go back to the home page

- -{{ partial "footer.html" . }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..39dcbec --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,17 @@ + + + + {{ partial "head.html" . }} + + +
+ {{ partial "header.html" . }} +
+
+ {{ block "main" . }}{{ end }} +
+ + + diff --git a/layouts/_default/home.html b/layouts/_default/home.html new file mode 100644 index 0000000..0df6597 --- /dev/null +++ b/layouts/_default/home.html @@ -0,0 +1,7 @@ +{{ define "main" }} + {{ .Content }} + {{ range site.RegularPages }} +

{{ .LinkTitle }}

+ {{ .Summary }} + {{ end }} +{{ end }} diff --git a/layouts/_default/list.html b/layouts/_default/list.html index b4d94d4..50fc92d 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,18 +1,8 @@ -{{ partial "header.html" . }} - -

{{ .Title }}

- -{{ .Content }} - -{{ range.Data.Pages }} -
-

- {{ .Title }} -

- -
+{{ define "main" }} +

{{ .Title }}

+ {{ .Content }} + {{ range .Pages }} +

{{ .LinkTitle }}

+ {{ .Summary }} + {{ end }} {{ end }} - -{{ partial "footer.html" . }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html index a903ad6..7e286c8 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,7 +1,10 @@ -{{ partial "header.html" . }} +{{ define "main" }} +

{{ .Title }}

-

{{ .Title }}

+ {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }} + {{ $dateHuman := .Date | time.Format ":date_long" }} + -{{ .Content }} - -{{ partial "footer.html" . }} + {{ .Content }} + {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} +{{ end }} diff --git a/layouts/index.html b/layouts/index.html deleted file mode 100644 index de7cc5f..0000000 --- a/layouts/index.html +++ /dev/null @@ -1,5 +0,0 @@ -{{ partial "header.html" . }} - -{{ .Content }} - -{{ partial "footer.html" . }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 76f737c..a7cd916 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,8 +1 @@ - - - - - - +

Copyright {{ now.Year }}. All rights reserved.

diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..02c2240 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,5 @@ + + +{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }} +{{ partialCached "head/css.html" . }} +{{ partialCached "head/js.html" . }} diff --git a/layouts/partials/head/css.html b/layouts/partials/head/css.html new file mode 100644 index 0000000..91b928d --- /dev/null +++ b/layouts/partials/head/css.html @@ -0,0 +1,9 @@ +{{- with resources.Get "css/main.css" }} + {{- if eq hugo.Environment "development" }} + + {{- else }} + {{- with . | minify | fingerprint }} + + {{- end }} + {{- end }} +{{- end }} diff --git a/layouts/partials/head/js.html b/layouts/partials/head/js.html new file mode 100644 index 0000000..18fe842 --- /dev/null +++ b/layouts/partials/head/js.html @@ -0,0 +1,12 @@ +{{- with resources.Get "js/main.js" }} + {{- if eq hugo.Environment "development" }} + {{- with . | js.Build }} + + {{- end }} + {{- else }} + {{- $opts := dict "minify" true }} + {{- with . | js.Build $opts | fingerprint }} + + {{- end }} + {{- end }} +{{- end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 2e6f67e..7980a00 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,22 +1,2 @@ - - - - - - - - {{ if not .IsHome }}{{ .Title }} | {{ end }}{{ .Site.Title }} - - - - {{ with .OutputFormats.Get "rss" -}} - {{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} - {{ end -}} - - - - - -{{ partial "nav.html" . }} - -
+

{{ site.Title }}

+{{ partial "menu.html" (dict "menuID" "main" "page" .) }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html new file mode 100644 index 0000000..7183180 --- /dev/null +++ b/layouts/partials/menu.html @@ -0,0 +1,51 @@ +{{- /* +Renders a menu for the given menu ID. + +@context {page} page The current page. +@context {string} menuID The menu ID. + +@example: {{ partial "menu.html" (dict "menuID" "main" "page" .) }} +*/}} + +{{- $page := .page }} +{{- $menuID := .menuID }} + +{{- with index site.Menus $menuID }} + +{{- end }} + +{{- define "partials/inline/menu/walk.html" }} + {{- $page := .page }} + {{- range .menuEntries }} + {{- $attrs := dict "href" .URL }} + {{- if $page.IsMenuCurrent .Menu . }} + {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} + {{- else if $page.HasMenuCurrent .Menu .}} + {{- $attrs = merge $attrs (dict "class" "ancestor" "aria-current" "true") }} + {{- end }} + {{- $name := .Name }} + {{- with .Identifier }} + {{- with T . }} + {{- $name = . }} + {{- end }} + {{- end }} +
  • + {{ $name }} + {{- with .Children }} + + {{- end }} +
  • + {{- end }} +{{- end }} diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html deleted file mode 100644 index cf07600..0000000 --- a/layouts/partials/nav.html +++ /dev/null @@ -1,14 +0,0 @@ - diff --git a/layouts/partials/terms.html b/layouts/partials/terms.html new file mode 100644 index 0000000..8a6ebec --- /dev/null +++ b/layouts/partials/terms.html @@ -0,0 +1,23 @@ +{{- /* +For a given taxonomy, renders a list of terms assigned to the page. + +@context {page} page The current page. +@context {string} taxonomy The taxonomy. + +@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }} +*/}} + +{{- $page := .page }} +{{- $taxonomy := .taxonomy }} + +{{- with $page.GetTerms $taxonomy }} + {{- $label := (index . 0).Parent.LinkTitle }} +
    +
    {{ $label }}:
    + +
    +{{- end }} diff --git a/readme.md b/readme.md index e655061..2ddf6a4 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1 @@ -# Optom Code Theme (WIP) - -Credit: https://github.com/ericmurphyxyz/hugo-starter-theme for starting template +# Hugo Optom Code Theme (WIP) diff --git a/static/css/style.css b/static/css/style.css deleted file mode 100644 index 4082b2b..0000000 --- a/static/css/style.css +++ /dev/null @@ -1,59 +0,0 @@ -/* LAYOUT */ - -body { - color: #333; - font-size: 125%; - line-height: 1.5; - max-width: 45rem; - padding: 1rem; - margin: 0 auto; -} - -.content { - margin-bottom: 2rem; -} - -/* NAVIGATION */ - -.site-nav { - display: flex; -} - -.site-nav a { - display: block; - padding: 1rem; -} - -.site-nav .logo { - font-weight: bold; - padding-left: 0; -} - -.main-menu { - display: flex; - list-style: none; - margin: 0; - padding: 0; -} - -@media screen and (max-width: 48rem) { - .site-nav, - .main-menu { - flex-direction: column; - } - - .site-nav a { - padding: 0.5rem; - padding-left: 0; - } -} - -/* LISTS */ - -.post-snippet { - margin-bottom: 1rem; -} - -.post-snippet h3 { - margin-bottom: 0.25rem; -} diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000..67f8b77 Binary files /dev/null and b/static/favicon.ico differ diff --git a/static/fonts/MonaspaceArgon-Regular.woff b/static/fonts/MonaspaceArgon-Regular.woff new file mode 100644 index 0000000..d57d694 Binary files /dev/null and b/static/fonts/MonaspaceArgon-Regular.woff differ diff --git a/static/fonts/MonaspaceRadon-Bold.woff b/static/fonts/MonaspaceRadon-Bold.woff new file mode 100644 index 0000000..91fcf15 Binary files /dev/null and b/static/fonts/MonaspaceRadon-Bold.woff differ diff --git a/static/fonts/MonaspaceRadon-BoldItalic.woff b/static/fonts/MonaspaceRadon-BoldItalic.woff new file mode 100644 index 0000000..085eeeb Binary files /dev/null and b/static/fonts/MonaspaceRadon-BoldItalic.woff differ diff --git a/static/fonts/MonaspaceRadon-Italic.woff b/static/fonts/MonaspaceRadon-Italic.woff new file mode 100644 index 0000000..c2cc4b3 Binary files /dev/null and b/static/fonts/MonaspaceRadon-Italic.woff differ diff --git a/static/fonts/MonaspaceRadon-Regular.woff b/static/fonts/MonaspaceRadon-Regular.woff new file mode 100644 index 0000000..9b9d8b5 Binary files /dev/null and b/static/fonts/MonaspaceRadon-Regular.woff differ diff --git a/static/fonts/Optiker-K.woff b/static/fonts/Optiker-K.woff new file mode 100644 index 0000000..dd12166 Binary files /dev/null and b/static/fonts/Optiker-K.woff differ diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..3ba3164 --- /dev/null +++ b/theme.toml @@ -0,0 +1,31 @@ +name = 'Theme name' +license = 'MIT' +licenselink = 'https://github.com/owner/repo/LICENSE' +description = 'Theme description' + +# The home page of the theme, where the source can be found +homepage = 'https://github.com/owner/repo' + +# If you have a running demo of the theme +demosite = 'https://owner.github.io/repo' + +# Taxonomy terms +tags = ['blog', 'company'] +features = ['some', 'awesome', 'features'] + +# If the theme has multiple authors +authors = [ + {name = 'Name of author', homepage = 'Website of author'}, + {name = 'Name of author', homepage = 'Website of author'} +] + +# If the theme has a single author +[author] + name = 'Your name' + homepage = 'Your website' + +# If porting an existing theme +[original] + author = 'Name of original author' + homepage = 'Website of original author' + repo = 'https://github.com/owner/repo'