From 0adf1cf9a2fc3fb6e270f67166c44a587a477dc5 Mon Sep 17 00:00:00 2001
From: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Date: Fri, 17 Mar 2023 20:17:52 +0800
Subject: some refactors
---
src/_includes/layouts/base.njk | 70 ++++++++++++------------------------------
src/_includes/layouts/page.njk | 35 +++++++++++++++++++++
src/index.md | 6 ++--
src/js/chrisApp.js | 30 +++++++++---------
src/lul.njk | 15 ++++-----
5 files changed, 79 insertions(+), 77 deletions(-)
create mode 100644 src/_includes/layouts/page.njk
diff --git a/src/_includes/layouts/base.njk b/src/_includes/layouts/base.njk
index f23e0b3..8688c95 100644
--- a/src/_includes/layouts/base.njk
+++ b/src/_includes/layouts/base.njk
@@ -1,53 +1,21 @@
-{% block header %}
-
-
-
-
-
- {{ title }}
-
-
-
-
- {% endblock %}
+
+
+
+
+
+ {{ title }}
+
+
+
+
+
-
-
- {% block content %}
- {{ content | safe }}
- {% endblock %}
-
- {% block footer %}
-
-
-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-

-
- {% endblock %}
-
+ {{ content | safe }}
+ {% block footer %}
+
+ {% endblock %}
-
-
-
\ No newline at end of file
+
diff --git a/src/_includes/layouts/page.njk b/src/_includes/layouts/page.njk
new file mode 100644
index 0000000..7eb4218
--- /dev/null
+++ b/src/_includes/layouts/page.njk
@@ -0,0 +1,35 @@
+---
+layout: "layouts/base.njk"
+---
+
+
+
+ {{ content | safe }}
+
+
+

+

+

+

+
+

+

+

+

+

+

+
+

+

+

+

+

+

+

+

+
+

+

+

+
+
diff --git a/src/index.md b/src/index.md
index 193f881..360a17e 100644
--- a/src/index.md
+++ b/src/index.md
@@ -1,5 +1,5 @@
---
-layout: layouts/base.njk
+layout: layouts/page.njk
title: guzzle guzzle
description: getchoo's website
---
@@ -8,4 +8,6 @@ description: getchoo's website
this is under construction. i'm experimenting with lume
-
\ No newline at end of file
+
+
+[click here](/lul/)
diff --git a/src/js/chrisApp.js b/src/js/chrisApp.js
index bf51176..4881b7a 100644
--- a/src/js/chrisApp.js
+++ b/src/js/chrisApp.js
@@ -1,23 +1,23 @@
const chrisURL = "/imgs/chris/";
function randomChris() {
- const files = [
- "chis_very_fried.jpg",
- "chris_medium_fried.jpg",
- "chris_moshed.jpg",
- "fried_publisher.jpg",
- "help_me.png",
- "nice_chris.png",
- "nice_publisher.png",
- "bkender_bauob.jpg",
- "blurry_chris.jpg",
- ];
+ const files = [
+ "chis_very_fried.jpg",
+ "chris_medium_fried.jpg",
+ "chris_moshed.jpg",
+ "fried_publisher.jpg",
+ "help_me.png",
+ "nice_chris.png",
+ "nice_publisher.png",
+ "bkender_bauob.jpg",
+ "blurry_chris.jpg",
+ ];
- // this chooses a random file from the array
- const url = chrisURL + files[Math.floor(Math.random() * files.length)];
+ // this chooses a random file from the array
+ const url = chrisURL + files[Math.floor(Math.random() * files.length)];
- window.location.href = url;
+ window.location.href = url;
}
-var chris = document.getElementById("chris_gif");
+const chris = document.getElementById("chris_gif");
chris.addEventListener("click", randomChris);
diff --git a/src/lul.njk b/src/lul.njk
index db2aa35..d0e249a 100644
--- a/src/lul.njk
+++ b/src/lul.njk
@@ -1,14 +1,11 @@
---
title: fard
description: xd
+layout: "layouts/base.njk"
---
-{% extends "_includes/layouts/base.njk" %}
-{% block body %}
-
-
-
-{% endblock %}
-{% block footer %}{% endblock %}
\ No newline at end of file
+
+
+
--
cgit v1.2.3
From 03c5675b909d07561777d2a1e88a856cec5f6ff6 Mon Sep 17 00:00:00 2001
From: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Date: Fri, 17 Mar 2023 20:44:47 +0800
Subject: refactor: retrieve Git revision from Lume
---
.github/workflows/deploy.yaml | 10 ++++------
_config.ts | 25 +++++++++++++++++++++++--
src/_includes/layouts/base.njk | 2 +-
src/_includes/layouts/index.njk | 28 ----------------------------
4 files changed, 28 insertions(+), 37 deletions(-)
delete mode 100644 src/_includes/layouts/index.njk
diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml
index 691cf6c..382cdbe 100644
--- a/.github/workflows/deploy.yaml
+++ b/.github/workflows/deploy.yaml
@@ -21,11 +21,9 @@ jobs:
uses: denoland/setup-deno@v1
with:
deno-version: v1.31.3
-
+
- name: build site
- run: |
- sed -i "s/commit:/commit: $GITHUB_SHA/" src/_includes/layouts/base.njk
- deno task build
+ run: deno task build
- name: setup pages
uses: actions/configure-pages@v3
@@ -34,7 +32,7 @@ jobs:
uses: actions/upload-pages-artifact@v1
with:
path: '_site'
-
+
- name: deploy
id: deployment
- uses: actions/deploy-pages@v1
\ No newline at end of file
+ uses: actions/deploy-pages@v1
diff --git a/_config.ts b/_config.ts
index d457326..1a2f473 100644
--- a/_config.ts
+++ b/_config.ts
@@ -8,8 +8,8 @@ import sass from "lume/plugins/sass.ts";
import sitemap from "lume/plugins/sitemap.ts";
const site = lume({
- src: "./src",
- location: new URL("https://getchoo.github.io"),
+ src: "./src",
+ location: new URL("https://getchoo.github.io"),
});
site.use(attributes());
@@ -19,7 +19,28 @@ site.use(date());
site.use(remark());
site.use(sass());
site.use(sitemap());
+
+const getGitRevision = async () => {
+ const p = Deno.run({
+ cmd: ["git", "rev-parse", "HEAD"],
+ stdout: "piped",
+ });
+ const [status, output] = await Promise.all([p.status(), p.output()]);
+
+ if (status.success) {
+ return new TextDecoder().decode(output).trim();
+ }
+
+ return null;
+};
+
+site.data(
+ "gitRevision",
+ await getGitRevision(),
+);
+
site.ignore("README.md", "LICENSE", ".gitignore", ".gitattributes");
+
site.copy("imgs");
site.copy("files");
site.copy("js");
diff --git a/src/_includes/layouts/base.njk b/src/_includes/layouts/base.njk
index 8688c95..b0fb268 100644
--- a/src/_includes/layouts/base.njk
+++ b/src/_includes/layouts/base.njk
@@ -14,7 +14,7 @@
{% block footer %}
{% endblock %}