Skip to content

Commit ac997de

Browse files
committed
Extract the giscus configuration to config.yml
1 parent ac91d25 commit ac997de

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

README.org

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,57 @@
77
The blog is migrated from the original self-hosted [[https://github.com/ramsayleung/blog][blog]] which was interesting and delightful to build something from scratch.
88

99
There is Ramsay's personal blog, where he shares a bit of what he has learned along the way.
10+
11+
* Cloning and Setup
12+
Even though this blog is tailored to serve my own purpose, but this blog is designed to be easily cloned and adapted for your own use as well. Here are the steps to get started:
13+
14+
** 1. Clone the Repository**
15+
#+begin_src shell
16+
git clone https://github.com/ramsayleung/ramsayleung.github.io.git
17+
cd ramsayleung.github.io
18+
#+end_src
19+
20+
** 2. Update Configuration**
21+
The main configuration file is `config.yml`. You'll need to update it with your personal information.
22+
23+
*** Social Media
24+
Update the information to your own social media accordingly.
25+
#+begin_src yaml
26+
params:
27+
socialIcons:
28+
- name: github
29+
url: "[YOUR_GITHUB_URL]"
30+
- name: stackoverflow
31+
url: "[YOUR_STACKOVERFLOW_URL]"
32+
- name: x
33+
url: "[YOUR_TWITTER_URL]"
34+
- name: linkedin
35+
url: "[YOUR LINKEDIN URL]"
36+
- name: telegram
37+
url: "[YOUR TELEGRAM URL]"
38+
#+end_src
39+
*** Giscus Comments
40+
This blog uses [[https://giscus.app/][giscus]] for comments, which is based on GitHub Discussions. To set it up for your own repository, you need to update the following section in `config.yml`:
41+
42+
#+begin_src yaml
43+
params:
44+
giscus:
45+
repo: "[YOUR_GITHUB_USERNAME]/[YOUR_REPO_NAME]"
46+
repoId: "[YOUR_REPO_ID]"
47+
category: "[YOUR_DISCUSSION_CATEGORY_NAME]"
48+
categoryId: "[YOUR_CATEGORY_ID]"
49+
50+
socialIcons:
51+
- name: github
52+
url: "[YOUR_GITHUB_URL]"
53+
- name: stackoverflow
54+
url: "[YOUR_STACKOVERFLOW_URL]"
55+
- name: x
56+
url: "[YOUR_TWITTER_URL]"
57+
- name: linkedin
58+
url: "[YOUR LINKEDIN URL]"
59+
- name: telegram
60+
url: "[YOUR TELEGRAM URL]"
61+
#+end_src
62+
63+
You can get the `repoId` and `categoryId` by following the instructions on the giscus website.

config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ params:
116116
minMatchCharLength: 0
117117
keys: ["title", "permalink", "summary", "content"]
118118

119+
giscus:
120+
repo: "ramsayleung/comment"
121+
repoId: "MDEwOlJlcG9zaXRvcnkzMDk2NjQ1NDk="
122+
category: "General"
123+
categoryId: "DIC_kwDOEnUbJc4Cltnz"
124+
119125
socialIcons:
120126
- name: github
121127
url: "https://github.com/ramsayleung"

layouts/partials/comments.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ <h2>Comments</h2>
2828
console.log('Initial giscus load');
2929
const commentScript = document.createElement("script");
3030
commentScript.setAttribute("src", "https://giscus.app/client.js");
31-
commentScript.setAttribute("data-repo", "ramsayleung/comment");
32-
commentScript.setAttribute("data-repo-id", "MDEwOlJlcG9zaXRvcnkzMDk2NjQ1NDk=");
33-
commentScript.setAttribute("data-category", "General");
34-
commentScript.setAttribute("data-category-id", "DIC_kwDOEnUbJc4Cltnz");
31+
commentScript.setAttribute("data-repo", "{{ .Site.Params.giscus.repo }}");
32+
commentScript.setAttribute("data-repo-id", "{{ .Site.Params.giscus.repoId }}");
33+
commentScript.setAttribute("data-category", "{{ .Site.Params.giscus.category }}");
34+
commentScript.setAttribute("data-category-id", "{{ .Site.Params.giscus.categoryId }}");
3535
commentScript.setAttribute("data-mapping", "pathname");
3636
commentScript.setAttribute("data-strict", "0");
3737
commentScript.setAttribute("data-reactions-enabled", "1");

0 commit comments

Comments
 (0)