miantiao-me/BroadcastChannel
GitHub: miantiao-me/BroadcastChannel
将 Telegram 频道内容渲染为 SEO 友好的微博客网站,支持 Serverless 和 Docker 部署。
Stars: 2064 | Forks: 1043
# BroadcastChannel
**将你的 Telegram 频道变成微博客。**
English | [简体中文](./README.zh-cn.md)
**目录:** [功能](#-features) · [演示](#-demo) · [技术栈](#-tech-stack) · [部署](#deployment) · [配置](#configuration) · [主题](#-themes) · [常见问题](#-faqs) · [赞助](#-sponsor)
## ✨ 功能
- **将你的 Telegram 频道变成微博客**
- **对 SEO 友好** `/sitemap.xml`
- **浏览器端 0 JS**
- **RSS 和 RSS JSON** `/rss.xml` `/rss.json`
## 🪧 演示
### 真实用户
- [面条实验室](https://memo.miantiao.me/)
- [Find Blog👁发现博客](https://broadcastchannel.pages.dev/)
- [Memos 广场 🎪](https://now.memobbs.app/)
- [APPDO 数字生活指南](https://mini.appdo.xyz/)
- [85.60×53.98卡粉订阅/提醒](https://tg.docofcard.com/)
- [新闻在花频道](https://tg.istore.app/)
- [ALL About RSS](https://blog.rss.tips/)
- [Charles Chin's Whisper](https://memo.eallion.com/)
- [PlayStation 新闻转发](https://playstationnews.pages.dev)
- [Yu's Life](https://daily.pseudoyu.com/)
- [Leslie 和朋友们](https://tg.imlg.co/)
- [OKHK 分享](https://tg.okhk.net/)
- [gledos 的微型博客](https://microblogging.gledos.science)
- [Steve Studio](https://tgc.surgeee.me/)
- [LiFePO4:沙雕吐槽](https://lifepo4.top)
- [Hotspot Hourly](https://hourly.top/)
- [大河马中文财经新闻分享](https://a.xiaomi318.com/)
- [\_My. Tricks 🎩 Collection](https://channel.mykeyvans.com)
- [小报童专栏精选](https://xiaobaotong.genaiprism.site/)
- [Fake news](https://fake-news.csgo.ovh/)
- [miyi23's Geekhub资源分享](https://gh.miyi23.top/)
- [Magazine|期刊杂志|财新周刊](https://themagazine.top)
- [Remote Jobs & Cooperation](https://share-remote-jobs.vercel.app/)
- [甬哥侃侃侃--频道发布](https://ygkkktg.pages.dev)
- [Fugoou.log](https://fugoou.xyz)
- [Bboysoul的博客](https://tg.bboy.app/)
- [MakerHunter](https://share.makerhunter.com/)
- [ChatGPT/AI新闻聚合](https://g4f.icu/)
- [Abner's memos](https://memos.abnerz6.top/)
- [Appinn Talk](https://talk.appinn.net/)
- [小报童优惠与排行榜](https://youhui.xiaobaoto.com/)
- [热干面拌 10 号土豆泥](https://memo.moran.im/)
- [万事屋工程部](https://t.wanshiwu.fyi/)
- [折腾啥 @xream](https://telegram.zhetengsha.eu.org)
### 平台
1. [Cloudflare Workers](https://broadcast-channel.run-on.workers.dev/)
2. [Netlify](https://broadcast-channel.netlify.app/)
3. [Vercel](https://broadcast-channel.vercel.app/)
BroadcastChannel 支持部署在支持 SSR 的 Cloudflare Workers、Netlify、Vercel 等 Serverless 平台上,或部署在 VPS 上。
Cloudflare Pages SSR 在 Astro 6 + @astrojs/cloudflare v13 下不受支持;在 Cloudflare 上部署请使用 Workers。
有关详细教程,请参阅[部署你的 Astro 站点](https://docs.astro.build/en/guides/deploy/)。
## 🧱 技术栈
- 框架:[Astro](https://astro.build/)
- CMS:[Telegram 频道](https://telegram.org/tour/channels)
- 主题灵感和 CSS 兼容性:[Bear Blog](https://github.com/HermanMartinus/bearblog)(独立实现,无官方关联,也未包含 Bear 源文件)
- 可选主题:[Sepia](https://github.com/Planetable/SiteTemplateSepia)
- 可选主题灵感:[Terminal](https://github.com/panr/hugo-theme-terminal)
- 可选主题灵感:[Aria](https://github.com/miantiao-me/astro-aria)
- 可选主题视觉灵感:[Hacker News](https://news.ycombinator.com/),由 Y Combinator 提供,为独立实现,无官方关联
- 可选主题视觉灵感:[Telegram 公开频道预览](https://t.me/s/),为独立实现,与 Telegram Messenger Inc. 无任何官方关联
- 可选主题视觉灵感:[Zed's Agentic Engineering 页面](https://zed.dev/agentic-engineering),为独立实现,与 Zed Industries, Inc. 无任何官方关联
## 🏗️ 部署
### Docker
1. `docker pull ghcr.io/miantiao-me/broadcastchannel:main`
2. `docker run -d --name broadcastchannel -p 4321:4321 -e CHANNEL=miantiao_me ghcr.io/miantiao-me/broadcastchannel:main`
### Serverless
1. [Fork](https://github.com/miantiao-me/BroadcastChannel/fork) 本项目到你的 GitHub
2. 在 Cloudflare Workers/Netlify/Vercel/EdgeOne 上创建一个项目
3. 选择 `BroadcastChannel` 项目和 `Astro` 框架
4. 配置环境变量 `CHANNEL` 为你的频道名称。这是最简配置,更多信息请参阅[配置](#configuration)
5. 保存并部署
6. 绑定域名(可选)
7. 更新代码,请参阅 GitHub 官方文档[从 Web UI 同步 Fork 分支](https://docs.github.com/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork#syncing-a-fork-branch-from-the-web-ui)
EdgeOne 已受到支持,并通过 std-env 的 `edgeone_pages` provider 或平台提供的 `EDGEONE_PROJECT_ID`/`EO_MAKERS` 变量进行自动检测。只有在需要覆盖自动 adapter 检测时,才需设置 `SERVER_ADAPTER`。
Cloudflare Workers 最简命令:
```
pnpm exec wrangler login
SERVER_ADAPTER=cloudflare_workers pnpm build
pnpm exec wrangler deploy
```
在 Workers dashboard 中或使用 `pnpm exec wrangler secret put CHANNEL` 配置 `CHANNEL` 和其他运行时值。
Cloudflare Pages SSR 在 Astro 6 + @astrojs/cloudflare v13 下不受支持。请将 Pages 部署迁移至 Workers。
## ⚒️ 配置
### 最简配置
仅需配置 `CHANNEL`。它是公开的 Telegram 频道用户名(即 `t.me/` 后面的字符串)。
```
CHANNEL=miantiao_me
```
### 完整参考
可选变量。另请参阅 [`.env.example`](./.env.example)。
```
## 必填项
CHANNEL=miantiao_me
## 语言和时区 (Intl/BCP 47 locale,例如 en 或 zh-CN)
LOCALE=en
TIMEZONE=America/New_York
## 社交用户名
TELEGRAM=miantiao-me
TWITTER=miantiao-me
GITHUB=miantiao-me
MASTODON=mastodon.social/@Mastodon
BLUESKY=bsky.app
## 社交 URL (必须提供完整 URL)
DISCORD=https://DISCORD.com
PODCAST=https://PODCAST.com
## 受信任管理员 raw HTML 注入 (header / footer)
HEADER_INJECT=
FOOTER_INJECT=
## SEO
NOFOLLOW=false
NOINDEX=false
## UI
HIDE_DESCRIPTION=false
COMMENTS=true
REACTIONS=true
RSS_BEAUTIFY=true
## 标签、链接和导航 (以逗号 / 分号分隔)
TAGS=tag1,tag2,tag3
LINKS=Title1,URL1;Title2,URL2;Title3,URL3;
NAVS=Title1,URL1;Title2,URL2;Title3,URL3;
## 搜索
GOOGLE_SEARCH_SITE=memo.miantiao.me
## 高级 (通常保持原样)
TELEGRAM_HOST=telegram.dog
STATIC_PROXY=
# 在需要时覆盖自动 adapter 检测。
SERVER_ADAPTER=
# 将仅包含 hostname 的 proxy 目标附加到默认设置中,以逗号分隔 (无 protocol、port 或 path)。
TARGET_WHITELIST=a.com,b.com
```
## 🎨 主题
基础主题始终会被加载。将 `HEADER_INJECT` 留空以使用基础主题,或者加载**且仅加载一个**内置的覆盖主题:
| 主题 | 路径 |
| ---------------- | ------------------------------ |
| Sepia | `/themes/sepia.css` |
| Aria | `/themes/aria.css` |
| Terminal Amber | `/themes/terminal-amber.css` |
| Terminal Green | `/themes/terminal-green.css` |
| Terminal Cyan | `/themes/terminal-cyan.css` |
| Terminal Magenta | `/themes/terminal-magenta.css` |
| HN News | `/themes/hn-news.css` |
| TG Channel | `/themes/tg-channel.css` |
| ZAE | `/themes/zae.css` |
```
HEADER_INJECT=''
```
HN News、TG Channel 和 ZAE 是固定的浅色主题。请勿直接加载 `/themes/terminal-base.css`;不存在 `/themes/terminal.css`。
完整配置、浅色/深色模式行为、平台 dashboard 值、自定义 CSS 和安全注意事项:**[THEMES.md](./THEMES.md)**。主题鸣谢:**[NOTICE.md](./NOTICE.md)**。
## 🙋🏻 常见问题
1. 为什么部署后内容为空?
- 频道必须是**公开**的
- 频道用户名是一个**字符串**,而不是数字
- 在频道设置中关闭**限制保存内容**
- 更改环境变量后请重新部署
- Telegram 可能会屏蔽某些敏感频道的公开展示;请在 `https://t.me/s/channelusername` 进行验证
## ☕ 赞助
1. [在 Telegram 上关注我](https://t.me/miantiao_me)
2. [在 𝕏 上关注我](https://404.li/x)
3. [在 GitHub 上赞助我](https://github.com/sponsors/miantiao-me)
标签:RSS, SEO优化, Syscall, Telegram, Web开发, 内容管理系统, 微博客, 无JavaScript, 程序员工具, 请求拦截