Skip to content

Commit 2e9f7e2

Browse files
authored
Merge pull request #123 from miantiao-me/copilot/add-env-variable-tg-intro
feat: add HIDE_DESCRIPTION env variable to control TG description visibility
2 parents d5249ad + e46b1ce commit 2e9f7e2

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ HEADER_INJECT=HEADER_INJECT
1616

1717
NO_FOLLOW=false
1818
NO_INDEX=false
19+
HIDE_DESCRIPTION=false
1920

2021
TELEGRAM_HOST=telegram.dog
2122
STATIC_PROXY=""

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ HEADER_INJECT=HEADER_INJECT
110110
NO_FOLLOW=false
111111
NO_INDEX=false
112112
113+
## Hide Telegram channel description
114+
HIDE_DESCRIPTION=false
115+
113116
## Sentry configuration options, collect server-side errors
114117
SENTRY_AUTH_TOKEN=SENTRY_AUTH_TOKEN
115118
SENTRY_DSN=SENTRY_DSN

README.zh-cn.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ HEADER_INJECT=HEADER_INJECT
108108
NO_FOLLOW=false
109109
NO_INDEX=false
110110
111+
## 隐藏 Telegram 频道简介
112+
HIDE_DESCRIPTION=false
113+
111114
## Sentry 配置项,收集服务端报错
112115
SENTRY_AUTH_TOKEN=SENTRY_AUTH_TOKEN
113116
SENTRY_DSN=SENTRY_DSN

src/components/header.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const MASTODON = getEnv(import.meta.env, Astro, 'MASTODON')
2222
const BLUESKY = getEnv(import.meta.env, Astro, 'BLUESKY')
2323
2424
const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
25+
const hideDescription = getEnv(import.meta.env, Astro, 'HIDE_DESCRIPTION')
2526
---
2627

2728
<div id="header">
@@ -102,7 +103,7 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
102103
</div>
103104

104105
{
105-
channel?.descriptionHTML && channel?.descriptionHTML.length > 0 && (
106+
hideDescription !== 'true' && channel?.descriptionHTML && channel?.descriptionHTML.length > 0 && (
106107
<div class="text-box" id="site-intro" set:html={channel?.descriptionHTML} />
107108
)
108109
}

0 commit comments

Comments
 (0)