From 58805381571574f39ff3ddeaf98f64d708486ca7 Mon Sep 17 00:00:00 2001 From: Jan Raasch Date: Mon, 31 Aug 2020 15:40:11 +0200 Subject: [PATCH] chore: initial commit --- .github/FUNDING.yml | 2 + .github/workflows/ci.yml | 32 ++++ .gitignore | 1 + .jsbeautifyrc | 27 +++ LICENSE | 20 +++ README.md | 67 ++++++++ archetypes/default.md | 9 + exampleSite/config.toml | 44 +++++ exampleSite/content/_index.md | 21 +++ exampleSite/content/blog/_index.md | 3 + exampleSite/content/blog/bear.md | 25 +++ exampleSite/content/blog/hugo.md | 31 ++++ exampleSite/content/blog/markdown-syntax.md | 144 ++++++++++++++++ exampleSite/static/favicon.ico | Bin 0 -> 15406 bytes exampleSite/static/images/favicon.png | Bin 0 -> 1312 bytes exampleSite/static/images/share.png | Bin 0 -> 25877 bytes images/screenshot.png | Bin 0 -> 37714 bytes images/tn.png | Bin 0 -> 25877 bytes layouts/404.html | 6 + layouts/_default/baseof.html | 43 +++++ layouts/_default/list.html | 57 +++++++ layouts/_default/single.html | 20 +++ layouts/index.html | 3 + layouts/partials/custom_body.html | 3 + layouts/partials/custom_head.html | 3 + layouts/partials/favicon.html | 2 + layouts/partials/footer.html | 1 + layouts/partials/head.html | 14 ++ layouts/partials/header.html | 4 + layouts/partials/nav.html | 5 + layouts/partials/seo_tags.html | 13 ++ layouts/partials/style.html | 99 +++++++++++ layouts/robots.txt | 2 + package-lock.json | 177 ++++++++++++++++++++ package.json | 28 ++++ theme.toml | 24 +++ 36 files changed, 930 insertions(+) create mode 100644 .github/FUNDING.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100644 .jsbeautifyrc create mode 100644 LICENSE create mode 100644 README.md create mode 100644 archetypes/default.md create mode 100644 exampleSite/config.toml create mode 100644 exampleSite/content/_index.md create mode 100644 exampleSite/content/blog/_index.md create mode 100644 exampleSite/content/blog/bear.md create mode 100644 exampleSite/content/blog/hugo.md create mode 100644 exampleSite/content/blog/markdown-syntax.md create mode 100644 exampleSite/static/favicon.ico create mode 100644 exampleSite/static/images/favicon.png create mode 100644 exampleSite/static/images/share.png create mode 100644 images/screenshot.png create mode 100644 images/tn.png create mode 100644 layouts/404.html create mode 100644 layouts/_default/baseof.html create mode 100644 layouts/_default/list.html create mode 100644 layouts/_default/single.html create mode 100644 layouts/index.html create mode 100644 layouts/partials/custom_body.html create mode 100644 layouts/partials/custom_head.html create mode 100644 layouts/partials/favicon.html create mode 100644 layouts/partials/footer.html create mode 100644 layouts/partials/head.html create mode 100644 layouts/partials/header.html create mode 100644 layouts/partials/nav.html create mode 100644 layouts/partials/seo_tags.html create mode 100644 layouts/partials/style.html create mode 100644 layouts/robots.txt create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 theme.toml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..c911893 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +custom: ['https://www.paypal.me/janraasch/7,00'] +github: ['janraasch'] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..807e17b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-18.04 + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: latest + + - name: Build local ./exampleSite + run: hugo --minify --gc --destination ../public --source ./exampleSite --themesDir ../.. --baseURL https://janraasch.github.io/hugo-bearblog/ + + - name: Deploy to GitHub Pages + if: github.event_name == 'push' + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./public diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3c3629e --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules diff --git a/.jsbeautifyrc b/.jsbeautifyrc new file mode 100644 index 0000000..4e39ba0 --- /dev/null +++ b/.jsbeautifyrc @@ -0,0 +1,27 @@ +{ + "indent_size": 2, + "indent_char": " ", + "indent_with_tabs": false, + "editorconfig": false, + "eol": "\n", + "end_with_newline": true, + "indent_level": 0, + "preserve_newlines": true, + "max_preserve_newlines": 10, + "space_in_paren": false, + "space_in_empty_paren": false, + "jslint_happy": false, + "space_after_anon_function": false, + "space_after_named_function": false, + "brace_style": "collapse", + "unindent_chained_methods": false, + "break_chained_methods": false, + "keep_array_indentation": false, + "unescape_strings": false, + "wrap_line_length": 0, + "e4x": false, + "comma_first": false, + "operator_position": "before-newline", + "indent_empty_lines": false, + "templating": ["auto"] +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..3be3bb7 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2020 Jan Raasch + +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/README.md b/README.md new file mode 100644 index 0000000..e679dfa --- /dev/null +++ b/README.md @@ -0,0 +1,67 @@ +# Hugo Bear Blog ![Test](https://github.com/janraasch/hugo-bearblog/workflows/CI/badge.svg?branch=master&event=push) + +🧸 A [Hugo](https://gohugo.io/)-theme based on [Bear Blog](https://bearblog.dev). + +> Free, no-nonsense, super-fast blogging. + +## Demo + +For a current & working demo of this theme, please check out https://janraasch.github.io/hugo-bearblog/ 🎯. + +## Installation + +If you already have a Hugo site on your machine, you can simply add this theme via + +``` +git submodule add https://github.com/janraasch/hugo-bearblog.git themes/hugo-bearblog +``` + +Then, adjust the `config.toml` as detailed below. + +For more information, read the official [setup guide][hugo-setup-guide] of Hugo. + +## Adjust configuration / config.toml + +Please check out the [config.toml](https://github.com/janraasch/hugo-bearblog/blob/master/exampleSite/config.toml) included in the [exampleSite](https://github.com/janraasch/hugo-bearblog/tree/master/exampleSite) of this theme. + +## Content & structure + +### Starting fresh + +If you are starting fresh, simply copy over the contents of the `exampleSite`-directory included in this theme to your source directory. That should give you a good idea about how things work, and then you can go on from there to make the site your own. + +### Adding content + +You can add **a new post/page** via running + +``` +hugo new blog/my-new-post.md +``` + +### Adding your branding / colors / css + +Add a `custom_head.html`-file to your `layouts/partials`-directory. In there you may add a ` + + {{ if .Data.Singular }} +

Filtering for "{{ .Title }}"

+ + Remove filter + + {{ end }} + + {{ if .Data.Singular }} + {{else}} + +
+ {{ range .Site.Taxonomies.tags }} + #{{ .Page.Title }}  + {{ end }} +
+
+ {{ end }} +
+{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..f993a0c --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,20 @@ +{{ define "main" }} +{{ if eq .Type "blog" }}{{ if not .Params.menu }} +

{{ .Title }}

+

+ + + +

+{{ end }}{{ end }} + + {{ .Content }} + +

+ {{ range (.GetTerms "tags") }} + #{{ .LinkTitle }} + {{ end }} +

+{{ end }} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..9983b08 --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,3 @@ +{{ define "main" }} +{{ .Content }} +{{ end }} diff --git a/layouts/partials/custom_body.html b/layouts/partials/custom_body.html new file mode 100644 index 0000000..951fb15 --- /dev/null +++ b/layouts/partials/custom_body.html @@ -0,0 +1,3 @@ + diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html new file mode 100644 index 0000000..4c53c40 --- /dev/null +++ b/layouts/partials/custom_head.html @@ -0,0 +1,3 @@ + diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html new file mode 100644 index 0000000..ccf1a5d --- /dev/null +++ b/layouts/partials/favicon.html @@ -0,0 +1,2 @@ +{{ with .Site.Params.favicon }} +{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html new file mode 100644 index 0000000..8eca955 --- /dev/null +++ b/layouts/partials/footer.html @@ -0,0 +1 @@ +{{ if ne .Site.Params.hideMadeWithLine true }}Made with Hugo ʕ•ᴥ•ʔ Bear{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html new file mode 100644 index 0000000..69488a7 --- /dev/null +++ b/layouts/partials/head.html @@ -0,0 +1,14 @@ + + + +{{- partial "favicon.html" . -}} +{{- block "title" . }}{{ .Site.Title }}{{- end }} + +{{- partial "seo_tags.html" . -}} + + +{{ with .OutputFormats.Get "rss" -}} +{{ printf `` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }} +{{ end -}} + +{{- partial "style.html" . -}} diff --git a/layouts/partials/header.html b/layouts/partials/header.html new file mode 100644 index 0000000..e47df70 --- /dev/null +++ b/layouts/partials/header.html @@ -0,0 +1,4 @@ + +

{{ .Site.Title }}

+
+ diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html new file mode 100644 index 0000000..dd06f47 --- /dev/null +++ b/layouts/partials/nav.html @@ -0,0 +1,5 @@ +Home +{{ range .Site.Menus.main }} +{{ .Name }} +{{ end }} +Blog diff --git a/layouts/partials/seo_tags.html b/layouts/partials/seo_tags.html new file mode 100644 index 0000000..0b01f8b --- /dev/null +++ b/layouts/partials/seo_tags.html @@ -0,0 +1,13 @@ + + + + + + +{{ template "_internal/opengraph.html" . }} + + +{{ template "_internal/twitter_cards.html" . }} + + +{{ template "_internal/schema.html" . }} diff --git a/layouts/partials/style.html b/layouts/partials/style.html new file mode 100644 index 0000000..d429eb2 --- /dev/null +++ b/layouts/partials/style.html @@ -0,0 +1,99 @@ + diff --git a/layouts/robots.txt b/layouts/robots.txt new file mode 100644 index 0000000..0326f5c --- /dev/null +++ b/layouts/robots.txt @@ -0,0 +1,2 @@ +User-Agent: * +Sitemap: {{ "sitemap.xml" | absURL }} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..97604df --- /dev/null +++ b/package-lock.json @@ -0,0 +1,177 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" + }, + "config-chain": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.12.tgz", + "integrity": "sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA==", + "requires": { + "ini": "^1.3.4", + "proto-list": "~1.2.1" + } + }, + "editorconfig": { + "version": "0.15.3", + "resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.15.3.tgz", + "integrity": "sha512-M9wIMFx96vq0R4F+gRpY3o2exzb8hEj/n9S8unZtHSvYjibBp/iMufSzvmOcV/laG0ZtuTVGtiJggPOSW2r93g==", + "requires": { + "commander": "^2.19.0", + "lru-cache": "^4.1.5", + "semver": "^5.6.0", + "sigmund": "^1.0.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==" + }, + "js-beautify": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.13.0.tgz", + "integrity": "sha512-/Tbp1OVzZjbwzwJQFIlYLm9eWQ+3aYbBXLSaqb1mEJzhcQAfrqMMQYtjb6io+U6KpD0ID4F+Id3/xcjH3l/sqA==", + "requires": { + "config-chain": "^1.1.12", + "editorconfig": "^0.15.3", + "glob": "^7.1.3", + "mkdirp": "^1.0.4", + "nopt": "^5.0.0" + } + }, + "lru-cache": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==" + }, + "nopt": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", + "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "requires": { + "abbrev": "1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" + }, + "proto-list": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=" + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=" + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==" + }, + "sigmund": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", + "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=" + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..2f8c84a --- /dev/null +++ b/package.json @@ -0,0 +1,28 @@ +{ + "name": "hugo-bearblog", + "private": true, + "version": "1.0.0", + "description": "🧸 A [Hugo](https://gohugo.io/)-theme based on [Bear Blog](https://bearblog.dev).", + "main": "index.js", + "devDependencies": { + "js-beautify": "^1.13.0" + }, + "scripts": { + "test": "npm run beautify", + "beautify": "js-beautify layouts/**/*.html -r" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/janraasch/hugo-bearblog.git" + }, + "author": { + "name": "Jan Raasch", + "email": "jan@janraasch.com", + "url": "https://www.janraasch.com" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/janraasch/hugo-bearblog/issues" + }, + "homepage": "https://github.com/janraasch/hugo-bearblog#readme" +} diff --git a/theme.toml b/theme.toml new file mode 100644 index 0000000..945be48 --- /dev/null +++ b/theme.toml @@ -0,0 +1,24 @@ +# theme.toml template for a Hugo theme +# See https://github.com/gohugoio/hugoThemes#themetoml for an example + +name = "Hugo Bear Blog" +license = "MIT" +licenselink = "https://github.com/janraasch/hugo-bearblog/blob/master/LICENSE" +description = "A Hugo theme based on »Bear Blog«. Free, no-nonsense, super-fast blogging." +homepage = "https://github.com/janraasch/hugo-bearblog" +tags = ["blog", "responsive", "minimal", "seo", "clean", "simple", "light", "minimalist", "mobile", "fast", "white", "minimalistic", "reading"] +features = ["favicon", "seo", "no stylesheets", "no javascript", "rss"] +min_version = "0.73.0" +# https://gohugo.io/content-management/taxonomies#default-taxonomies +# https://gohugo.io/templates/taxonomy-templates/#example-list-tags-in-a-single-page-template +# https://gohugo.io/templates/taxonomy-templates/#example-list-all-site-tags + +[author] + name = "Jan Raasch" + homepage = "https://www.janraasch.com" + +# If porting an existing theme +[original] + name = "ʕ•ᴥ•ʔ Bear Blog" + homepage = "https://bearblog.dev" + repo = "https://github.com/HermanMartinus/bearblog"