8000 GitHub - tangwz/tang: An Astro blog theme. · GitHub
[go: up one dir, main page]

Skip to content
tangwzPublic

About

An Astro blog theme.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

Terence Tang · Creator Theme

English | 简体中文

An Astro theme for writing, videos, and a personal portfolio.

TypeScript Tailwind CSS MIT License

Terence Tang homepage with a personal introduction and a link to the portfolio

Features · Getting started · Documentation · Deployment

✨ Features

  • Homepage and portfolio — A personal introduction, featured work, category filters, and pagination with filter state saved in the URL.
  • English and Chinese — English at the root and Chinese under /zh/, with paired translations, fallback content, and language switching.
  • Light and dark themes — Follow the system preference or switch manually, with layouts for mobile and desktop.
  • Markdown and MDX — Validated content schemas, a table of contents, syntax highlighting, code copying, tables, footnotes, and image previews.
  • LaTeX math — Inline and display equations rendered to SVG at build time, with no extra rendering scripts in the browser.
  • Bilibili videos and transcripts — Support for BV/AV identifiers, full video URLs, and multipart videos; short links open on Bilibili.
  • Search and discovery — Static full-text search with Pagefind, tags, archives, and RSS feeds for each language.
  • Sharing and SEO — Canonical URLs, hreflang, a sitemap, and dynamic Open Graph images with Chinese text support.
  • Publishing controls — Drafts, sample labels, and scheduled content evaluated at build time.
  • Newsletter pages — A public letter archive and a subscription form that can be connected to an email provider.

The repository includes clearly labeled sample content and still uses example.com as its site URL. Newsletter subscriptions are disabled by default; the course page presents a planned outline.

🚀 Getting started

Use Node.js 24 and pnpm 11.3.0 to match CI. The minimum supported Node.js version is 22.12.0.

git clone https://github.com/tangwz/tang.git
cd tang
pnpm install --frozen-lockfile
pnpm dev

Visit localhost:4321 for English or localhost:4321/zh/ for Chinese.

Search requires an index generated during the build. To preview the complete search experience:

pnpm build
pnpm preview

📁 Project structure

.
├── docs/
│   ├── GUIDE.md              # Configuration and content guide (English)
│   ├── GUIDE.zh-CN.md        # Configuration and content guide (Chinese)
│   ├── RELEASE.md            # Deployment and rollback (English)
│   └── RELEASE.zh-CN.md      # Deployment and rollback (Chinese)
├── public/                  # Static images and favicon
├── src/
│   ├── assets/              # Local fonts, icons and images
│   ├── components/          # Shared UI components
│   ├── content/
│   │   ├── posts/           # Markdown and MDX articles
│   │   └── videos/          # Videos and transcripts
│   ├── data/                # Profile, books, courses and letters
│   ├── i18n/                # Translations and locale helpers
│   ├── layouts/             # Page and article layouts
│   ├── pages/               # Routes, including /zh/
│   ├── styles/              # Theme and reading styles
│   ├── utils/               # Content, search and build helpers
│   ├── views/               # Page views shared by both languages
│   └── content.config.ts    # Content schemas
├── scripts/                 # Build and release checks
├── astro-paper.config.ts    # Site configuration
└── astro.config.ts          # Astro integrations and fonts

Place Chinese translations in the zh/ subdirectory of the corresponding article or video directory, using the same filenames as their English counterparts.

📖 Documentation

Topic Start here
Site configuration, publishing, and translation rules User guide
Profile, content, and page styling Theme configuration example
Headings, code, tables, and math typography Markdown showcase
Domain setup, Newsletter integration, deployment, and rollback Release guide
The original theme and upstream documentation AstroPaper repository

With the development server running, read the theme configuration guide and Markdown showcase on the site.

⚙️ Customization

Start with your site settings, profile, and first article:

Content Location
Domain, title, author, pagination, and feature flags astro-paper.config.ts
Portrait, book notes, courses, and Newsletter name src/data/creator.ts
Public Newsletter letters src/data/letters.ts
Articles and video transcripts src/content/posts/ · src/content/videos/
Homepage introduction and personal story src/views/Home.astro · src/views/About.astro
Chinese interface text src/i18n/messages/zh.json · src/i18n/lang/zh.json
Colors, homepage layout, and reading styles src/styles/

Public subscription settings are listed in .env.example. The form appears only when all required values are present and valid. See Newsletter integration for provider fields, confirmation emails, and unsubscribe flows.

Optional Google Analytics 4 tracking is configured through site.googleAnalyticsId in astro-paper.config.ts. See the Google Analytics guide for setup, navigation tracking, and verification.

🧰 Tech stack

Purpose Technology
Static site and content Astro · TypeScript · Markdown / MDX
Styling Tailwind CSS · Custom CSS
Full-text search Pagefind
Math remark-math · MathJax
Dynamic Open Graph images Satori · Sharp · Astro Fonts
Code quality ESLint · Prettier · Node.js test runner
Continuous integration GitHub Actions

See package.json and the lockfile for dependency versions. English pages use local Fraunces and Arimo fonts; Chinese pages use system font stacks. Chinese Open Graph images use local Noto Sans SC.

🧞 Commands

Run all commands from the project root.

Command Action
pnpm dev Start the local development server
pnpm build Run type checks, build the site, generate the search index, and validate output
pnpm preview Preview the built site
pnpm test Run unit tests
pnpm lint Check code with ESLint
pnpm format:check Check formatting
pnpm format Format files
pnpm sync Sync Astro types
pnpm check:build Validate an existing build
pnpm build:release Validate the production domain and create a release build

📦 Build and deploy

The build output is written to dist/ and can be deployed to a static hosting provider. Replace the placeholder domain, profile, and sample content before running pnpm build:release; this command rejects placeholder domains. Scheduled content requires a new build at publication time.

CI runs lint, unit tests, formatting checks, and a full build. It retains static artifacts named by commit SHA for 14 days. dist/build-info.json records the version and source revision for release tracking and rollback.

No hosting provider or automatic deployment is configured yet. See the release guide for the full process.

📜 Credits and license

Thanks to Sat Naing and the AstroPaper contributors for the theme foundation, and to Ali Abdaal for the personal website design inspiration.

The code retains the upstream copyright notice under the MIT License. Fonts use their respective SIL Open Font Licenses; see src/assets/fonts/. Image sources are listed in public/images/CREDITS.txt.

About

An Astro blog theme.

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0