Compare commits

...

20 Commits

Author SHA1 Message Date
Wen Junhua 9f956cad85
Merge 2cf1371c3e into 587f85e2e0 2024-01-22 23:14:04 +08:00
James Panther 587f85e2e0
🔨 Preparing release v2.8.0 2024-01-22 09:22:32 +11:00
James Panther e8a701a215
💄 Rebuild CSS 2024-01-22 09:20:40 +11:00
James Panther 17e9df5f4d
Merge branch 'dev' of https://github.com/jpanther/congo into dev 2024-01-22 09:19:36 +11:00
James Panther 98902cf06b
📝 Update changelog 2024-01-22 09:19:34 +11:00
James Panther b2f82274ed
🔀 Merge pull request #778 from Jh123x/feat/use-meta-refresh
feat: use meta tag to redirect externalURLs
2024-01-22 09:17:59 +11:00
James Panther 25f82b2f28
🚧 Remove redundant `else` block 2024-01-22 09:12:19 +11:00
James Panther d659edb7df
🔀 Merge pull request #792 from boscacci:patch-1
Add one entry to congo users table
2024-01-22 09:09:44 +11:00
James Panther f9c29f8a21
📝 Update user list localisations 2024-01-22 09:08:33 +11:00
Robert Boscacci b04ca3fb3d
Add one entry to congo users table
I added my personal portfolio website. Congo is credited on my About page.
2024-01-21 01:32:40 -05:00
Wen Junhua c514283044 feat: use meta tag to redirect externalURLs 2024-01-14 01:39:06 +08:00
Wen Junhua 2cf1371c3e fix: remove debug logs 2023-12-31 13:26:09 +08:00
Wen Junhua a1a2e10481
Merge branch 'dev' into feat/add-icon-script 2023-12-31 13:24:13 +08:00
Wen Junhua 97a3f0064c feat: port script to node 2023-12-31 13:24:02 +08:00
Wen Junhua a7fa3be37d
Merge branch 'dev' into feat/add-icon-script 2023-12-26 17:19:40 +09:00
Wen Junhua 679898570c docs: update script docs 2023-12-25 23:27:14 +09:00
Wen Junhua db07288d01 chore: clean up code 2023-12-25 23:24:47 +09:00
Wen Junhua 3c81e00bed chore: clean up code 2023-12-25 23:17:40 +09:00
Wen Junhua eb527de54b feat: add docs update 2023-12-25 23:13:32 +09:00
Wen Junhua 3a998b4598 feat: add script to auto update icons 2023-12-25 22:17:25 +09:00
12 changed files with 859 additions and 35 deletions

View File

@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
## [Unreleased] ## [Unreleased]
## [2.8.0] - 2024-01-22
### Added ### Added
- Quicklink support ([#646](https://github.com/jpanther/congo/pull/646)) - Quicklink support ([#646](https://github.com/jpanther/congo/pull/646))
@ -16,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Weibo sharing links ([#756](https://github.com/jpanther/congo/pull/756)) - Weibo sharing links ([#756](https://github.com/jpanther/congo/pull/756))
- Support for Tailwind '950' colour variants ([#751](https://github.com/jpanther/congo/pull/751)) - Support for Tailwind '950' colour variants ([#751](https://github.com/jpanther/congo/pull/751))
- Table of contents will now scroll if taller than the browser height ([#733](https://github.com/jpanther/congo/pull/733)) - Table of contents will now scroll if taller than the browser height ([#733](https://github.com/jpanther/congo/pull/733))
- External URL article stubs now auto-redirect if leaf pages are generated ([#778](https://github.com/jpanther/congo/pull/778))
- Korean translation ([#731](https://github.com/jpanther/congo/pull/731)) - Korean translation ([#731](https://github.com/jpanther/congo/pull/731))
- Chinese translation of Example site and Docs ([#776](https://github.com/jpanther/congo/pull/776)) - Chinese translation of Example site and Docs ([#776](https://github.com/jpanther/congo/pull/776))
@ -838,7 +841,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Advanced customisation using simple Tailwind colour definitions and styles - Advanced customisation using simple Tailwind colour definitions and styles
- Fully documented - Fully documented
[Unreleased]: https://github.com/jpanther/congo/compare/v2.7.6...HEAD [Unreleased]: https://github.com/jpanther/congo/compare/v2.8.0...HEAD
[2.8.0]: https://github.com/jpanther/congo/compare/v2.7.6...v2.8.0
[2.7.6]: https://github.com/jpanther/congo/compare/v2.7.5...v2.7.6 [2.7.6]: https://github.com/jpanther/congo/compare/v2.7.5...v2.7.6
[2.7.5]: https://github.com/jpanther/congo/compare/v2.7.4...v2.7.5 [2.7.5]: https://github.com/jpanther/congo/compare/v2.7.4...v2.7.5
[2.7.4]: https://github.com/jpanther/congo/compare/v2.7.3...v2.7.4 [2.7.4]: https://github.com/jpanther/congo/compare/v2.7.3...v2.7.4

View File

@ -1,4 +1,4 @@
/*! Congo v2.7.6 | MIT License | https://github.com/jpanther/congo */ /*! Congo v2.8.0 | MIT License | https://github.com/jpanther/congo */
/*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com */ /*! tailwindcss v3.4.1 | MIT License | https://tailwindcss.com */
@ -1798,10 +1798,6 @@ code {
top: 5rem; top: 5rem;
} }
.top-8 {
top: 2rem;
}
.top-\[100vh\] { .top-\[100vh\] {
top: 100vh; top: 100vh;
} }
@ -2000,22 +1996,14 @@ code {
height: 3rem; height: 3rem;
} }
.h-2 {
height: 0.5rem;
}
.h-24 {
height: 6rem;
}
.h-36 {
height: 9rem;
}
.h-8 { .h-8 {
height: 2rem; height: 2rem;
} }
.h-auto {
height: auto;
}
.h-full { .h-full {
height: 100%; height: 100%;
} }

View File

@ -1,4 +1,4 @@
/*! Congo v2.7.6 | MIT License | https://github.com/jpanther/congo */ /*! Congo v2.8.0 | MIT License | https://github.com/jpanther/congo */
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;

View File

@ -70,5 +70,6 @@ La lista a continuación es solo un puñado de sitios web creados con el tema Co
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog | | [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog | | [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog | | [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
**¿Usuaria de congo?** Para agregar tu sitio a esta lista, [haz un pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md). **¿Usuaria de congo?** Para agregar tu sitio a esta lista, [haz un pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md).

View File

@ -70,5 +70,6 @@ Congoを使用して構築された実際のウェブサイト。
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog | | [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog | | [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog | | [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
**Congoを使っていますか** あなたのウェブサイトを加えるために[Pull Request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md)を投げてください。 **Congoを使っていますか** あなたのウェブサイトを加えるために[Pull Request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md)を投げてください。

View File

@ -70,5 +70,6 @@ The list below is just a handful of the websites that are built using the Congo
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog | | [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog | | [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog | | [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
**Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md). **Congo user?** To add your site to this list, [submit a pull request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md).

View File

@ -70,5 +70,6 @@ showEdit: false
| [jnsgr.uk](https://jnsgr.uk) | Personal site and blog | | [jnsgr.uk](https://jnsgr.uk) | Personal site and blog |
| [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog | | [stupidjoey.net](https://stupidjoey.net) | Personal Site and Tech blog |
| [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog | | [aminelch.github.io](https://aminelch.github.io) | Personal Site and Blog |
| [robertboscacci.com](https://robertboscacci.com) | Personal Site and Blog |
**想成为Congo的用户** 要将您的网站添加到此列表中,请提交[Pull Request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md)来添加。 **想成为Congo的用户** 要将您的网站添加到此列表中,请提交[Pull Request](https://github.com/jpanther/congo/blob/dev/exampleSite/content/users/index.md)来添加。

View File

@ -120,6 +120,9 @@
{{ with .Site.Params.verification.yandex }} {{ with .Site.Params.verification.yandex }}
<meta name="yandex-verification" content="{{ . }}" /> <meta name="yandex-verification" content="{{ . }}" />
{{ end }} {{ end }}
{{ with $.Params.externalUrl }}
<meta http-equiv="refresh" content="0; url={{ . }}" />
{{ end }}
{{/* Social */}} {{/* Social */}}
{{ template "_internal/opengraph.html" . }} {{ template "_internal/opengraph.html" . }}
{{ template "_internal/twitter_cards.html" . }} {{ template "_internal/twitter_cards.html" . }}

743
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{ {
"name": "hugo-congo-theme", "name": "hugo-congo-theme",
"version": "2.7.6", "version": "2.8.0",
"description": "Congo theme for Hugo", "description": "Congo theme for Hugo",
"scripts": { "scripts": {
"preinstall": "rimraf assets/lib", "preinstall": "rimraf assets/lib",
@ -9,7 +9,8 @@
"dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w", "dev": "NODE_ENV=development ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit -w",
"build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit", "build": "NODE_ENV=production ./node_modules/tailwindcss/lib/cli.js -i ./assets/css/main.css -o ./assets/css/compiled/main.css --jit",
"example": "hugo server --bind 0.0.0.0 -p 8008 --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ ", "example": "hugo server --bind 0.0.0.0 -p 8008 --source exampleSite --themesDir ../.. --buildDrafts -b http://localhost/congo/ ",
"lighthouse": "lhci autorun" "lighthouse": "lhci autorun",
"add-icon": "node scripts/index.js add-icon"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -32,6 +33,7 @@
"@tailwindcss/typography": "^0.5.10", "@tailwindcss/typography": "^0.5.10",
"chart.js": "^4.4.1", "chart.js": "^4.4.1",
"fuse.js": "^7.0.0", "fuse.js": "^7.0.0",
"jsdom": "^23.0.1",
"katex": "^0.16.9", "katex": "^0.16.9",
"mermaid": "^10.7.0", "mermaid": "^10.7.0",
"prettier": "^3.2.4", "prettier": "^3.2.4",

11
scripts/index.js 100644
View File

@ -0,0 +1,11 @@
#!/usr/bin/env node
const { program } = require("commander");
const { add_icon_to_congo } = require("./update_icon");
// Adds an icon to the project.
program
.command("add-icon <icon_name>")
.description("Add icon to the project")
.action(add_icon_to_congo);
program.parse(process.argv);

View File

@ -0,0 +1,97 @@
const jsdom = require("jsdom");
const fs = require("fs");
const DOC_DIR = "./exampleSite/content/samples/icons";
const FONTAWESOME_VERSION = "v6.5.1";
const DEFAULT_TABLE_DELIMITER = "| -------------------- | --------------------------------- |";
/**
* Saves an icon to the congo project and update documentation.
* @param {string} icon_name Icon name from Font Awesome to download
* @returns null
*/
const add_icon_to_congo = async (icon_name) => {
try {
const icon_url = create_icon_url(icon_name, FONTAWESOME_VERSION);
const file = await get_file(icon_url);
const final_svg = modify_svg_string(file);
const icon_download_path = create_icon_download_path(icon_name);
save_file(icon_download_path, final_svg);
add_documentation(icon_name);
} catch (e) {
console.log(e);
return;
}
};
const modify_svg_string = (svg_string) => {
try {
dom = new jsdom.JSDOM(svg_string);
svg = dom.window.document.documentElement.querySelector("svg");
svg.querySelector("path").setAttribute("fill", "currentColor");
return svg.outerHTML;
} catch (e) {
throw new Error("Invalid SVG file");
}
};
const create_icon_url = (icon_name, fontawesome_version) => {
return `https://site-assets.fontawesome.com/releases/${fontawesome_version}/svgs/brands/${icon_name}.svg`;
};
const create_icon_download_path = (icon_name) => {
return `./assets/icons/${icon_name}.svg`;
};
const get_file = async (url) => {
console.log("Getting file at " + url + "...");
const response = await fetch(url);
if (response.status >= 400) {
throw new Error("Could not download icon / icon not found");
}
console.log("File retrieved!");
return response.text();
};
const save_file = (file_path, file) => {
console.log("Saving file at " + file_path + "...");
fs.writeFile(file_path, file, function (err) {
if (err) throw err;
console.log("File saved!");
});
};
const add_documentation = async (icon_name) => {
files = get_md_docs();
for (const file of files) {
const file_path = `${DOC_DIR}/${file}`;
const file_contents = fs.readFileSync(file_path, "utf8");
const file_result = process_file(file_contents, icon_name);
// Save file_result to file_path
fs.writeFile(file_path, file_result, function (err) {
if (err) throw err;
});
console.log(`Updated ${file_path}`);
}
};
/**
* Process the file contents to include the icon name.
* @param {string} file_contents contents of the documentation files.
* @returns {string} processed file contents.
*/
const process_file = (file_contents, icon_name) => {
const [headers, table] = file_contents.split(DEFAULT_TABLE_DELIMITER);
const table_rows = table.split("\n").map((x) => x.trim()).filter((row) => row !== "");
table_rows.push(table_rows[0].replace("amazon", icon_name));
table_rows.sort();
const new_table = table_rows.join("\n");
return `${headers.trimEnd()}\n${DEFAULT_TABLE_DELIMITER}\n${new_table}\n`;
};
const get_md_docs = () => {
return fs.readdirSync(DOC_DIR).filter((file) => file.endsWith(".md"));
};
module.exports = { add_icon_to_congo };