🔀 Merge branch 'dev' into chart

pull/26/head
James Panther 2021-10-29 16:27:55 +11:00
commit 52fd737c58
No known key found for this signature in database
GPG Key ID: D36F789E45745D17
26 changed files with 526 additions and 463 deletions

View File

@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
### Added
- Chart.js support using `chart` shortcode
- Dark mode toggle with new theme parameters for managing light/dark appearance
- French translation ([#18](https://github.com/jpanther/congo/pull/18))
- Grouping by year can now be specificed in front matter on list pages
@ -18,6 +19,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Bundled Mermaid for better vendor dependency management
- Mermaid diagrams are now themed to match the configured colour scheme
### Fixed
- Site logo image dimensions are unconstrained ([#19](https://github.com/jpanther/congo/issues/19))
- Article summary styled incorrectly in dark mode
## [1.4.0] - 2021-10-20
### Added

View File

@ -14,7 +14,7 @@ Congo is designed to be a simple, lightweight theme for [Hugo](https://gohugo.io
- Built with Tailwind CSS JIT for minified stylesheets without any excess code
- Fully responsive layout
- Multiple colour schemes (or fully customise your own)
- Dark mode (auto-switching based upon browser)
- Dark mode (forced on/off or auto-switching with user toggle)
- Highly customisable configuration
- Multiple homepage layouts
- Flexible with any content types, taxonomies and menus

View File

@ -3,6 +3,4 @@ title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
description: ""
slug: "{{ .File.BaseFileName }}"
topics: []
---

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="moon" class="svg-inline--fa fa-moon fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z"></path></svg>

After

Width:  |  Height:  |  Size: 531 B

View File

@ -0,0 +1 @@
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="sun" class="svg-inline--fa fa-sun fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z"></path></svg>

After

Width:  |  Height:  |  Size: 813 B

View File

@ -6,6 +6,8 @@
# https://jpanther.github.io/congo/docs/configuration/#theme-parameters
colorScheme = "congo"
# darkMode = "auto"
# darkToggle = false
# logo = "img/logo.jpg"
# description = "My awesome website"
# mainSections = ["section1", "section2"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -27,6 +27,9 @@ summaryLength = 0
[taxonomies]
tag = "tags"
[params]
# logo = "logo.jpg"
[params.homepage]
layout = "custom"
showRecent = true

View File

@ -56,6 +56,8 @@ Many of the article defaults here can be overridden on a per article basis by sp
|Name|Type|Default|Description|
| --- | --- | --- | --- |
|`colorScheme`|string|`"congo"`|The theme colour scheme to use. Valid values are `congo` (default), `avocado`, `ocean`, `fire` and `slate`. Refer to the [Colour Schemes]({{< ref "getting-started#colour-schemes" >}}) section for more details.|
|`darkMode`|boolean or string|`"auto"`|The preferred theme appearance for dark mode. Set to `true` to force dark appearance or `false` to force light appearance. Using `"auto"` will defer to the user's operating system preference.|
|`darkToggle`|boolean|`false`|When `darkMode` is set to `"auto"`, this parameter determines whether or not to show the appearance toggle in the site footer. The browser's local storage is used to persist the user's preference.|
|`logo`|string|_Not set_|The relative path to the site logo file within the `assets/` folder. The logo file should be provided at 2x resolution and supports any image dimensions.|
|`description`|string|_Not set_|The description of the website for metadata purposes.|
|`mainSections`|array of strings|_Not set_|The sections that should be displayed in the recent articles list. If not provided the section with the greatest number of articles is used.|

View File

@ -11,9 +11,7 @@ cascade:
Congo brings your content to life. :heart_eyes:
{{< /lead >}}
This section contains some demo pages that show how Congo renders different types of content. These pages come from Hugo's official [hugoBasicExample](https://github.com/gohugoio/hugoBasicExample) repository.
You can also see an example [taxonomy listing]({{< ref "tags" >}}) page.
This section contains some demo pages that show how Congo renders different types of content. You can also see an example [taxonomy listing]({{< ref "tags" >}}) page.
_**Sidenote:** This page is just a standard Congo article listing and Hugo has been configured to generate a `samples` content type and display article summaries._

View File

@ -0,0 +1,90 @@
---
title: "Diagrams and Flowcharts"
date: 2019-03-06
description: "Guide to Mermaid usage in Congo"
summary: "It's easy to add diagrams and flowcharts to articles using Mermaid."
tags: ["mermaid", "sample", "diagram"]
---
Mermaid diagrams are supported in Congo using the `mermaid` shortcode. Simply wrap the diagram markup within the shortcode. Congo automatically themes Mermaid diagrams to match the configured `colorScheme` parameter.
The examples below are a small selection taken from the [official Mermaid docs](https://mermaid-js.github.io/mermaid/). You can also [view the page source](https://raw.githubusercontent.com/jpanther/congo/dev/exampleSite/content/samples/diagrams-flowcharts.md) on GitHub to see the markup.
## Flowchart
{{< mermaid >}}
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
B --> G[/Another/]
C ==>|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[Car]
subgraph Section
C
D
E
F
G
end
{{< /mermaid >}}
## Sequence diagram
{{< mermaid >}}
sequenceDiagram
autonumber
par Action 1
Alice->>John: Hello John, how are you?
and Action 2
Alice->>Bob: Hello Bob, how are you?
end
Alice->>+John: Hello John, how are you?
Alice->>+John: John, can you hear me?
John-->>-Alice: Hi Alice, I can hear you!
Note right of John: John is perceptive
John-->>-Alice: I feel great!
loop Every minute
John-->Alice: Great!
end
{{< /mermaid >}}
## Class diagram
{{< mermaid >}}
classDiagram
Animal "1" <|-- Duck
Animal <|-- Fish
Animal <--o Zebra
Animal : +int age
Animal : +String gender
Animal: +isMammal()
Animal: +mate()
class Duck{
+String beakColor
+swim()
+quack()
}
class Fish{
-int sizeInFeet
-canEat()
}
class Zebra{
+bool is_wild
+run()
}
{{< /mermaid >}}
## Entity relationship diagram
{{< mermaid >}}
erDiagram
CUSTOMER }|..|{ DELIVERY-ADDRESS : has
CUSTOMER ||--o{ ORDER : places
CUSTOMER ||--o{ INVOICE : "liable for"
DELIVERY-ADDRESS ||--o{ ORDER : receives
INVOICE ||--|{ ORDER : covers
ORDER ||--|{ ORDER-ITEM : includes
PRODUCT-CATEGORY ||--|{ PRODUCT : contains
PRODUCT ||--o{ ORDER-ITEM : "ordered in"
{{< /mermaid >}}

View File

@ -1,22 +0,0 @@
---
title: "Emoji Support"
date: 2019-03-05
description: "Guide to emoji usage in Hugo"
summary: "📖🏞️🧗🏽🪂🐉🧙🏽‍♂️🧚🏽👸"
tags: ["emoji", "sample"]
---
Emoji can be enabled in a Hugo project in a number of ways.
The [`emojify`](https://gohugo.io/functions/emojify/) function can be called directly in templates or [Inline Shortcodes](https://gohugo.io/templates/shortcode-templates/#inline-shortcodes).
To enable emoji globally, set `enableEmoji` to `true` in your site's [configuration](https://gohugo.io/getting-started/configuration/) and then you can type emoji shorthand codes directly in content files; e.g.
<p><span class="nowrap"><span class="emojify">🙈</span> <code>:see_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙉</span> <code>:hear_no_evil:</code></span> <span class="nowrap"><span class="emojify">🙊</span> <code>:speak_no_evil:</code></span></p>
<br>
The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference for emoji shorthand codes.
---
**N.B.** The above steps enable Unicode Standard emoji characters and sequences in Hugo, however the rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack.

View File

@ -0,0 +1,19 @@
---
title: "Emoji"
date: 2019-03-05
description: "Guide to Emoji usage in Congo"
summary: "📖🏞️🧗🏽🪂🐉🧙🏽‍♂️🧚🏽👸"
tags: ["emoji", "sample"]
---
Emoji is supported throughout Congo by default. Emoji can be used in titles, menu items and article content.
{{< alert >}}
**Note:** The rendering of these glyphs depends on the browser and the platform. To style the emoji you can either use a third party emoji font or a font stack.
{{< /alert >}}
Emoji replacements are controlled via the `enableEmoji` parameter in your [site configuration]({{< ref "configuration#site-configuration" >}}). Set it to `true` and then you can type Emoji shorthand codes directly in content files.
**Example:** `see_no_evil` :see_no_evil:, `hear_no_evil` :hear_no_evil:, `speak_no_evil` :speak_no_evil:.
The [Emoji cheat sheet](http://www.emoji-cheat-sheet.com/) is a useful reference for emoji shorthand codes.

View File

@ -1,11 +1,11 @@
---
title: "Markdown Syntax Guide"
title: "Markdown"
date: 2019-03-11
description: "Sample article showcasing basic Markdown syntax and formatting for HTML elements."
tags: ["markdown", "css", "html", "sample"]
---
This article offers a sample of basic Markdown syntax that can be used in Hugo content files, also it shows whether basic HTML elements are decorated with CSS in a Hugo theme.
This article offers a sample of basic Markdown formatting that can be used in Congo, also it shows how some basic HTML elements are decorated.
<!--more-->

View File

@ -22,24 +22,16 @@ Rursus nulli murmur; hastile inridet ut ab gravi sententia! Nomine potitus silen
4. Arcanaque montibus omnes
5. Quidem et
# Vagus elidunt
## Vagus elidunt
<svg class="canon" xmlns="http://www.w3.org/2000/svg" overflow="visible" viewBox="0 0 496 373" height="373" width="496"><g fill="none"><path stroke="#000" stroke-width=".75" d="M.599 372.348L495.263 1.206M.312.633l494.95 370.853M.312 372.633L247.643.92M248.502.92l246.76 370.566M330.828 123.869V1.134M330.396 1.134L165.104 124.515"></path><path stroke="#ED1C24" stroke-width=".75" d="M275.73 41.616h166.224v249.05H275.73zM54.478 41.616h166.225v249.052H54.478z"></path><path stroke="#000" stroke-width=".75" d="M.479.375h495v372h-495zM247.979.875v372"></path><ellipse cx="498.729" cy="177.625" rx=".75" ry="1.25"></ellipse><ellipse cx="247.229" cy="377.375" rx=".75" ry="1.25"></ellipse></g></svg>
[The Van de Graaf Canon](https://en.wikipedia.org/wiki/Canons_of_page_construction#Van_de_Graaf_canon)
## Mane refeci capiebant unda mulcebat
### Mane refeci capiebant unda mulcebat
Victa caducifer, malo vulnere contra dicere aurato, ludit regale, voca! Retorsit colit est profanae esse virescere furit nec; iaculi matertera et visa est, viribus. Divesque creatis, tecta novat collumque vulnus est, parvas. **Faces illo pepulere** tempus adest. Tendit flamma, ab opes virum sustinet, sidus sequendo urbis.
Iubar proles corpore raptos vero auctor imperium; sed et huic: manus caeli Lelegas tu lux. Verbis obstitit intus oblectamina fixis linguisque ausus sperare Echionides cornuaque tenent clausit possit. Omnia putatur. Praeteritae refert ausus; ferebant e primus lora nutat, vici quae mea ipse. Et iter nil spectatae vulnus haerentia iuste et exercebat, sui et.
Eurytus Hector, materna ipsumque ut Politen, nec, nate, ignari, vernum cohaesit sequitur. Vel **mitis temploque** vocatus, inque alis, _oculos nomen_ non silvis corpore coniunx ne displicet illa. Crescunt non unus, vidit visa quantum inmiti flumina mortis facto sic: undique a alios vincula sunt iactata abdita! Suspenderat ego fuit tendit: luna, ante urbem Propoetides **parte**.
{{< css.inline >}}
<style>
.canon { background: white; width: 100%; height: auto; }
</style>
{{< /css.inline >}}

View File

@ -15,10 +15,11 @@ showEdit: false
Real websites that are built with Congo.
{{< /lead >}}
| Website | Details |
| -------------------------------------------- | ---------------------------- |
| [jamespanther.com](https://jamespanther.com) | Personal site - Theme author |
| [zekeriyaay.com](https://zekeriyaay.com) | Personal cheat sheets site |
| [srisco.dev](https://srisco.dev) | Personal site |
| Website | Details |
| ---------------------------------------------- | ---------------------------- |
| [jamespanther.com](https://jamespanther.com) | Personal site - Theme author |
| [zekeriyaay.com](https://zekeriyaay.com) | Personal cheat sheets site |
| [srisco.dev](https://srisco.dev) | Personal site |
| [theophile-roos.fr](https://theophile-roos.fr) | Personal site |
**Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users.md).

View File

@ -16,6 +16,8 @@ error:
404_description: "It seems that the page you've requested does not exist."
footer:
dark_appearance: "Switch to dark appearance"
light_appearance: "Switch to light appearance"
powered_by: "Powered by {{ .Hugo }} &amp; {{ .Congo }}"
list:

View File

@ -1,7 +1,7 @@
article:
anchor_label: "Ancre"
draft: "Brouillon"
edit_title: "Editer"
edit_title: "Editer"
reading_time:
one: "{{ .Count }} min"
other: "{{ .Count }} mins"
@ -16,6 +16,8 @@ error:
404_description: "Il semble que la page que vous cherchiez n'existe pas."
footer:
# dark_appearance: "Switch to dark appearance"
# light_appearance: "Switch to light appearance"
powered_by: "Propulsé par {{ .Hugo }} &amp; {{ .Congo }}"
list:

View File

@ -15,6 +15,8 @@ error:
404_description: "您请求的页面似乎不存在。"
footer:
# dark_appearance: "Switch to dark appearance"
# light_appearance: "Switch to light appearance"
powered_by: "由 {{ .Hugo }} &amp; {{ .Congo }} 强力驱动"
list:
@ -25,6 +27,7 @@ sharing:
email: "通过电子邮件发送"
facebook: "分享到 Facebook"
linkedin: "分享到 LinkedIn"
# pinterest: "Pin on Pinterest"
reddit: "提交到 Reddit"
twitter: "分享到 Twitter"

View File

@ -1,5 +1,8 @@
<!DOCTYPE html>
<html lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en{{ end }}">
<html
lang="{{ with .Site.LanguageCode }}{{ . }}{{ else }}en{{ end }}"
{{ if .Site.Params.darkMode | default false }}class="dark"{{ end }}
>
{{- partial "head.html" . -}}
<body
class="flex flex-col h-screen px-6 m-auto text-lg leading-7 bg-neutral text-neutral-900 sm:px-14 md:px-24 lg:px-32 dark:bg-neutral-800 dark:text-neutral max-w-7xl"

View File

@ -34,7 +34,7 @@
{{ partial "article-meta.html" . }}
</div>
{{ if .Params.showSummary | default (.Site.Params.list.showSummary | default false) }}
<div class="py-1 prose">
<div class="py-1 prose dark:prose-light">
{{ .Summary | emojify }}
</div>
{{ end }}

View File

@ -16,26 +16,53 @@
</ul>
</nav>
{{ end }}
{{/* Copyright */}}
<p class="text-sm text-neutral-400 dark:text-neutral-500">
{{- with .Site.Copyright }}
{{ . | emojify | markdownify }}
{{- else }}
&copy;
{{ now.Format "2006" }}
{{ .Site.Author.name | markdownify | emojify }}
{{- end }}
</p>
{{/* Theme attribution */}}
{{ if .Site.Params.attribution | default true }}
<p class="text-xs text-neutral-300 dark:text-neutral-600">
{{ $hugo := printf `<a class="hover:underline hover:underline-primary-300 hover:text-primary-400"
href="https://gohugo.io/" target="_blank" rel="noopener noreferrer">Hugo</a>`
}}
{{ $congo := printf `<a class="hover:underline hover:underline-primary-300 hover:text-primary-400" href="https://git.io/hugo-congo" target="_blank" rel="noopener noreferrer">Congo</a>` }}
{{ i18n "footer.powered_by" (dict "Hugo" $hugo "Congo" $congo) | safeHTML }}
</p>
{{ end }}
<div class="flex justify-between">
<div>
{{/* Copyright */}}
<p class="text-sm text-neutral-400 dark:text-neutral-500">
{{- with .Site.Copyright }}
{{ . | emojify | markdownify }}
{{- else }}
&copy;
{{ now.Format "2006" }}
{{ .Site.Author.name | markdownify | emojify }}
{{- end }}
</p>
{{/* Theme attribution */}}
{{ if .Site.Params.attribution | default true }}
<p class="text-xs text-neutral-300 dark:text-neutral-600">
{{ $hugo := printf `<a class="hover:underline hover:underline-primary-300 hover:text-primary-400"
href="https://gohugo.io/" target="_blank" rel="noopener noreferrer">Hugo</a>`
}}
{{ $congo := printf `<a class="hover:underline hover:underline-primary-300 hover:text-primary-400" href="https://git.io/hugo-congo" target="_blank" rel="noopener noreferrer">Congo</a>` }}
{{ i18n "footer.powered_by" (dict "Hugo" $hugo "Congo" $congo) | safeHTML }}
</p>
{{ end }}
</div>
{{/* Dark mode toggle */}}
{{ if and (.Site.Params.darkToggle | default false) (eq (.Site.Params.darkMode | default "auto") "auto") }}
<div class="text-sm cursor-pointer text-neutral-400 dark:text-neutral-500">
<button
id="dark-toggle"
onclick="setPreferredAppearance('dark');"
oncontextmenu="setPreferredAppearance('default'); return false;"
class="inline px-2 py-1 border rounded-md border-neutral-200 dark:hidden hover:text-primary-500 hover:border-primary-400"
title="{{ i18n "footer.dark_appearance" }}"
>
{{ partial "icon.html" "moon" }}
</button>
<button
id="light-toggle"
onclick="setPreferredAppearance('light');"
oncontextmenu="setPreferredAppearance('default'); return false;"
class="hidden px-2 py-1 border rounded-md cursor-pointer dark:inline border-neutral-700 hover:text-primary-400 hover:border-primary-500"
title="{{ i18n "footer.light_appearance" }}"
>
{{ partial "icon.html" "sun" }}
</button>
</div>
{{ end }}
</div>
{{/* Extend footer - eg. for extra scripts, etc. */}}
{{ if templates.Exists "partials/extend-footer.html" }}
{{ partialCached "extend-footer.html" . }}

View File

@ -62,6 +62,31 @@
integrity="{{ $customStyles.Data.Integrity }}"
/>
{{ end }}
{{ if eq (.Site.Params.darkMode | default "auto") "auto" }}
<script>
function loadPreferredAppearance() {
if (localStorage.preferredAppearance === "dark" || (!("preferredAppearance" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
}
function setPreferredAppearance(scheme) {
if (scheme == "default") {
localStorage.removeItem("preferredAppearance");
} else {
localStorage.preferredAppearance = scheme;
}
loadPreferredAppearance();
}
loadPreferredAppearance();
window.matchMedia("(prefers-color-scheme: dark)").addListener(loadPreferredAppearance);
</script>
{{ else }}
<script>
localStorage.removeItem("preferredAppearance");
</script>
{{ end }}
{{/* Icons */}}
{{ if templates.Exists "partials/favicons.html" }}
{{ partialCached "favicons.html" .Site }}

View File

@ -11,6 +11,7 @@
src="{{ $logo.RelPermalink }}"
width="{{ div $logo.Width 2 }}"
height="{{ div $logo.Height 2 }}"
class="max-w-[10rem] max-h-[10rem] object-scale-down object-left"
alt="{{ .Site.Title }}"
/>
</a>

View File

@ -10,7 +10,7 @@ module.exports = {
"./themes/congo/content/**/*.{html,md}",
],
},
darkMode: "media",
darkMode: "class",
theme: {
colors: {
transparent: "transparent",