Skip to content

About

My personal blog made with Go

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

chebread.org

This blog is generated by a custom Static Site Generator (SSG) built from scratch with Go. It features a frontend pipeline and a fully automated deployment process using GitHub Actions.

Blog link: https://chebread.org/

Table of Contents

Features

  • Custom Go SSG
  • Markdown-Based Content
  • GitHub-Style & Custom Callouts (Alerts)
  • Build-Time Syntax Highlighting
  • LaTeX Support
  • Image Zooming
  • Manual Anchor Links for Headings
  • Frontend Tooling
  • Automated CI/CD Pipeline

Tech Stack

  • Static Site Generator (SSG): Go
  • Content: Markdown with YAML Front Matter parsed with Goldmark
  • LaTeX Rendering: KaTeX + Hugo Passthrough extension
  • Styling: SCSS compiled with Dart Sass
  • JavaScript: TypeScript (bundled with esbuild)
  • Image Zoom: medium-zoom
  • Package Manager: pnpm
  • Deployment: GitHub Actions

How to Run

Install Dependencies

go install github.com/cortesi/devd/cmd/devd@latest

brew install chroma

chroma --html-styles --style=github > layout/styles/chroma.css

pnpm install

Build Project

pnpm run build

Run the Development Server

pnpm run serve

Rebuild Project

pnpm run watch

This command checks for changes to layout directory files and executes pnpm run build.

How to Use devd

devd DIR_NAME # Run the server from the DIR_NAME directory

devd -l DIR_NAME # Run the server using livereload

devd -o DIR_NAME # Run the server and Open the browser

devd -ol DIR_NAME # Run the server and open a browser using livereload

killall devd # Kill devd process

How to Use localias

localias set devd.test 8000

localias remove devd.test

localias clear

localias list

localias status

localias start

localias stop

localias run

How to Use rclone

Blog images are hosted on Cloudflare R2 (https://cdn.chebread.org/blog/) and uploaded with rclone.

  • r2:chebread-cdn/blog/ → https://cdn.chebread.org/blog/<file> (blog post images & thumbnails)

Initial Setup

Install rclone and check your config file path (e.g., ~/.rclone.conf):

brew install rclone
rclone config file

Add the r2 remote using placeholder credentials from Cloudflare R2 Account API Tokens (Object Read & Write scoped to chebread-cdn):

[r2]
type = s3
provider = Cloudflare
access_key_id = <ACCESS_KEY_ID>
secret_access_key = <SECRET_ACCESS_KEY>
region = auto
endpoint = https://<ACCOUNT_ID>.r2.cloudflarestorage.com
acl = private
no_check_bucket = true

Upload Files

# Upload a single file -> https://cdn.chebread.org/blog/image.webp
rclone copy -P ./image.webp r2:chebread-cdn/blog/

# Upload and rename -> https://cdn.chebread.org/blog/new-name.webp
rclone copyto -P ./source.webp r2:chebread-cdn/blog/new-name.webp

# Upload multiple specific files from the same directory
rclone copy -P ./assets/ r2:chebread-cdn/blog/ \
  --include "a.webp" \
  --include "b.webp"

# Upload multiple files using a brace pattern (keep quotes so zsh does not expand it)
rclone copy -P ./assets/ r2:chebread-cdn/blog/ --include "{a,b}.webp"

# Upload all files matching an extension
rclone copy -P ./assets/ r2:chebread-cdn/blog/ --include "*.webp"

# Upload an entire directory (skips unchanged files already on R2)
rclone copy -P ./assets/ r2:chebread-cdn/blog/ --exclude ".DS_Store"

# Upload multiple files from different directories
for f in ./assets/a.webp ~/Downloads/b.png; do
  rclone copy -P "$f" r2:chebread-cdn/blog/
done

Preview, List, and Delete

# Dry run (preview what would be uploaded without transferring)
rclone copy -n ./assets/ r2:chebread-cdn/blog/ --include "*.webp"

# List files on R2
rclone ls r2:chebread-cdn/blog/

# Delete a single file from R2
rclone deletefile r2:chebread-cdn/blog/image.webp

How to Create Manual Anchor Links

You can create links that jump to specific headings within a page. This is useful for building a table of contents.

Assign a Custom ID to a Heading

Append {#your-custom-id} directly after your heading text. This ID will be the target for your link.

## My Awesome Section {#section-1}

Link to the Heading

Use the standard Markdown link syntax. The URL part should be a # followed by the custom ID you created.

[Go to my awesome section](#section-1)

Example

## Table of Contents
- [Go to Section 1](#section-1)
- [Go to Section 2](#section-2)

## My Awesome Section {#section-1}
Here is the content for the first section.

## Another Awesome Section {#section-2}
Here is the content for the second section.

Note

It is recommended to use only letters, numbers, and hyphens (-) for IDs to ensure URL compatibility. Special characters (like ?, &) should be avoided. Korean characters are also supported.

How to Use Callouts

You can use GitHub-style callout (alert) blocks and custom-titled callouts in your posts.

Standard GitHub Alerts

The blog natively supports the 5 standard GitHub alert types: NOTE, TIP, IMPORTANT, WARNING, and CAUTION.

> [!NOTE]
> Useful information that users should know, even when skimming content.

> [!TIP]
> Helpful advice for doing things better or more easily.

> [!IMPORTANT]
> Key information users need to know to achieve their goal.

> [!WARNING]
> Urgent info that needs immediate user attention to avoid problems.

> [!CAUTION]
> Advises about risks or negative outcomes of certain actions.

Custom Titles & Styles

You can customize the title and choose a specific alert style using the [!style|title] syntax. The available styles are note, tip, important, warning, and caution.

> [!caution|foo]
> boo

> [!warning|foo]
> boo

> [!tip|foo]
> boo

If you do not specify a style, it defaults to the note (blue) style:

> [!foo]
> boo

How to Use Footnotes

You can write footnotes using standard Markdown footnote syntax ([^id] and [^id]: ...), powered by a custom Goldmark footnote extension (lib/footnote.go).

Basic Syntax

Place [^1] inline where you want the superscript link, and define the footnote anywhere below (typically at the bottom of the post) using [^1]: with a colon immediately after the closing bracket.

이번 해커톤에서 dna-factory[^1]와 dna-eval[^2]를 사용해 보았다.

---

[^1]: https://github.com/dnotitia/dna-factory 참고.
[^2]: https://github.com/dnotitia/dna-eval 참고.

For multi-paragraph footnotes, indent continuation paragraphs with 4 spaces:

본문 내용[^1].

[^1]: 첫 번째 문단입니다.

    두 번째 문단입니다.

Rendering & Navigation Behavior

  • Paragraph Style (No <ol> / <li>): Single-paragraph footnotes render as standard <p id="fn:1"><sup>1</sup> ... [되돌아가기]</p> elements, matching the exact font size and text color of normal body paragraphs.
  • In-Place Rendering: Each footnote renders at the exact position where its [^id]: ... definition is written (not moved to the bottom of the document), both in HTML and in auto desc extraction.
  • Automatic Backlinks: A [되돌아가기] link returning to #fnref:1 is appended automatically—do not write it manually.
  • Manual Divider: No automatic <hr> or border-top is inserted above footnotes. Add --- in Markdown whenever you want a divider line.
  • 45% Instant Anchor Scroll: Clicking a footnote number or [되돌아가기] jumps instantly to 45% of the viewport height and updates the URL hash with history.replaceState so browser Back navigation is not polluted.
  • Important: Always include the colon ([^1]: ...). Without the colon, [^1] is treated as plain text instead of a footnote.

Linking an Entire Phrase (Manual HTML)

Standard Markdown footnotes ([^1]) only make the superscript number (1) clickable. If you want an entire phrase to be clickable (boo¹), write both the inline reference and the bottom footnote manually in HTML:

이번 해커톤에서 <a href="#1" id="ref-1">dna-factory<sup>1</sup></a>를 사용해 보았다.

---

<p id="1"><sup>1</sup> <a href="https://github.com/dnotitia/dna-factory">https://github.com/dnotitia/dna-factory</a> 참고. <a href="#ref-1">[되돌아가기]</a></p>

Note

  • Do not mix a manual HTML inline link (<a href="#fn:1">...</a>) with a Markdown footnote definition ([^1]: ...)—Goldmark removes footnote definitions that have no matching [^1] reference in the body.
  • Avoid mixing Markdown footnotes ([^1]) and manual HTML footnotes (#1) within the same post so numbering stays consistent.
  • If you use this inside a heading and want the heading text included in auto desc, use Markdown heading syntax (# <a href="#1" id="ref-1">Title<sup>1</sup></a>) rather than <h1>...</h1>.

How Auto Description Extraction Works

Each post's description is used on /posts, /posts/<category>, HTML meta/OG/Twitter/JSON-LD tags, and rss.xml.

Priority

  1. Manual desc in Front Matter: If desc: is provided and non-empty in YAML front matter, that exact value is used as-is (no truncation).
  2. Automatic Extraction: If desc: is omitted or empty, main.go reads the full Markdown body and converts it to plain text via lib/markdown_to_plain_text.go.

Extraction Rules (lib/markdown_to_plain_text.go)

The body is parsed with Goldmark (MarkExtension, CalloutExtension, NewFootnoteExtension) and walked in document order:

Markdown / HTML Element Included in desc? Details
Paragraphs, headings, lists, blockquotes Included Plain text extracted; block boundaries and line breaks become spaces
Links ([text](url)), emphasis (**b**, ==m==) Included (text only) Markdown markers and link URLs are stripped
Images (![alt](url)) Alt text only Image URL is stripped; alt text (if any) is kept
Inline code (`code`) Included Backticks stripped; backslash escapes inside code spans are kept literally
Escaped punctuation (\-, \*, etc.) Included (unescaped) Unescaped to plain punctuation (-, *) in normal text
Callouts (> [!NOTE] / > [!tip|Title]) Body included Callout tag syntax ([!...]) is stripped; body text is kept
Markdown footnotes ([^1] / [^1]: text) Body included, markers excluded Inline [^1] and [되돌아가기] are omitted; footnote body text (text) is included if within the character limit
Inline HTML (<a href="#1">text</a>) Inner text included HTML tags themselves are stripped; plain text between them is kept
Inline <sup>...</sup> and <sub>...</sub> Excluded Both tags and inner content (e.g., <sup>1</sup>) are skipped
Block HTML (<h1>...</h1>, <p id="1">...</p>, <div>...</div>) Excluded (entire block) Lines starting with a block HTML tag are parsed as HTMLBlock and skipped completely. Use # <a ...>Title</a> if you want heading text included
Fenced / indented code blocks (```) Excluded Code blocks are skipped
Horizontal rules (---) Excluded No text emitted

Normalization & Length Limit (main.go)

  • All consecutive whitespace and newlines are collapsed into single spaces.
  • If the resulting text exceeds 100 characters (Unicode runes), it is truncated to the first 100 characters followed by ...; otherwise, it is used in full.

How to Configure Title-Sorted Categories

By default, posts in each category are sorted chronologically by date (newest first). For tutorial or series categories (such as book chapters or lectures), you can configure them to be sorted purely by title (1-9, ㄱ-ㅎ, a-z) regardless of post dates.

Simply add the category name to content/title_sorted_categories.yml:

- Introducing Python
- CSAPP

How to Use Markdown

If you add two spaces to the end of a sentence, it becomes <br/> function.

How to Deploy

To publish a new post or deploy changes, you must push a specially formatted Git tag. The deployment is handled automatically by GitHub Actions.

Commit Your Changes

First, make sure all your new content and changes are committed to the main branch.

# Stage all changes
git add .

# Commit the changes
git commit -m "post: foo: boo"

# Push the commit to the main branch
git push origin main

Create a Deploy Tag

The deployment workflow is triggered by a tag. Create a new tag based on the current date. The format is post/YYYY-MM-DD-XX, where XX is a two-digit number for posts on the same day (e.g., 01, 02).

# Example for the first post on September 23, 2025
git tag post/2025-09-23-01

Push the Tag to Deploy

Push the newly created tag to GitHub. This is the final step that will trigger the automatic build and deployment process.

git push origin post/2025-09-23-01

You can now go to the Actions tab in your GitHub repository to watch the deployment progress. Your site will be live with the new content in a few minutes.

Commit Attribution Policy

Every new commit in this repository explicitly declares its authorship using Git trailers:

Commit Trailer Meaning
Written-by: Human Purely human-authored code
Assisted-by: <model> Primarily human-authored code containing AI-generated snippets
Generated-by: <model> with human modifications Primarily AI-generated code modified by human
Generated-by: <model> Logic generated entirely by AI

License

Copyright © 2026 Haneum Cha

This project is licensed under the Hippocratic License 3.0 (HL-3.0). By using this software, you agree to the terms and conditions set forth in the LICENSE file. For more information about this license, please visit firstdonoharm.dev.

About

My personal blog made with Go

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Contributors

Languages