From 47b7c969f13682363ff107b7220bbb3322a7ee1a Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Mon, 24 Aug 2026 17:51:58 +0800 Subject: [PATCH] feat(layouts): add post disclaimer/declaration feature (#832) Add a lightweight disclaimer notice at the beginning of articles to indicate content origin (AI-generated, repost, original, custom). - Add params.disclaimer config with enable, type, content options - Support 4 types: ai, repost, original, custom - Add custom SVG icons for ai/repost/original types - Add i18n translations for 20 languages - Add shimmer animation effect with RTL and reduce-motion support --- CLAUDE.md | 1 + assets/images/icons/disclaimer/ai.svg | 1 + assets/images/icons/disclaimer/original.svg | 1 + assets/images/icons/disclaimer/repost.svg | 1 + assets/scss/pages/posts/_disclaimer.scss | 63 +++++++++++++++++++++ assets/scss/pages/posts/_index.scss | 1 + hugo.toml | 10 ++++ i18n/ar.toml | 6 ++ i18n/de.toml | 6 ++ i18n/en.toml | 6 ++ i18n/es.toml | 6 ++ i18n/fa.toml | 6 ++ i18n/fr.toml | 6 ++ i18n/hi.toml | 6 ++ i18n/it.toml | 6 ++ i18n/ja.toml | 6 ++ i18n/ko.toml | 6 ++ i18n/pl.toml | 6 ++ i18n/pt-BR.toml | 6 ++ i18n/ro.toml | 6 ++ i18n/ru.toml | 6 ++ i18n/sr.toml | 6 ++ i18n/ur.toml | 6 ++ i18n/vi.toml | 6 ++ i18n/zh-CN.toml | 6 ++ i18n/zh-TW.toml | 6 ++ layouts/_partials/single/disclaimer.html | 38 +++++++++++++ layouts/posts/single.html | 4 +- 28 files changed, 233 insertions(+), 1 deletion(-) create mode 100644 assets/images/icons/disclaimer/ai.svg create mode 100644 assets/images/icons/disclaimer/original.svg create mode 100644 assets/images/icons/disclaimer/repost.svg create mode 100644 assets/scss/pages/posts/_disclaimer.scss create mode 100644 layouts/_partials/single/disclaimer.html diff --git a/CLAUDE.md b/CLAUDE.md index d997de5a..19ce64f1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -106,6 +106,7 @@ Hugo Pipes processes all assets. The key orchestration is in `_partials/base/ass - CSS classes: BEM or semantic naming (`header-desktop`, `menu-item`) - SCSS variables: hyphen-separated, semantic (`$global-font-family`) - CSS custom properties: prefixed with `fi-` / `--fi-` +- Use `fi-var()` function to reference CSS custom properties (auto-adds `--fi-` prefix), never use `var(--fi-...)` directly - Use CSS variables for theme switching; SCSS variables for colors (no hardcoded values) - Prefer relative units (rem, em, %) over absolute units - Keep selector nesting shallow diff --git a/assets/images/icons/disclaimer/ai.svg b/assets/images/icons/disclaimer/ai.svg new file mode 100644 index 00000000..e2a4f11a --- /dev/null +++ b/assets/images/icons/disclaimer/ai.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/icons/disclaimer/original.svg b/assets/images/icons/disclaimer/original.svg new file mode 100644 index 00000000..266ccd98 --- /dev/null +++ b/assets/images/icons/disclaimer/original.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/icons/disclaimer/repost.svg b/assets/images/icons/disclaimer/repost.svg new file mode 100644 index 00000000..0f58801d --- /dev/null +++ b/assets/images/icons/disclaimer/repost.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/scss/pages/posts/_disclaimer.scss b/assets/scss/pages/posts/_disclaimer.scss new file mode 100644 index 00000000..ce4cb1d1 --- /dev/null +++ b/assets/scss/pages/posts/_disclaimer.scss @@ -0,0 +1,63 @@ +@use "core/functions" as *; +@use "core/mixins" as *; + +@keyframes disclaimer-shimmer { + 0% { + background-position: 100% 0; + } + 100% { + background-position: -100% 0; + } +} + +@keyframes disclaimer-shimmer-rtl { + 0% { + background-position: -100% 0; + } + 100% { + background-position: 100% 0; + } +} + +.post-disclaimer { + display: flex; + align-items: center; + gap: 0.25em; + padding: 0.25rem 0; + font-size: 0.8em; + color: fi-var(global-font-tertiary-color); + + .post-disclaimer__content { + background: linear-gradient( + 90deg, + fi-var(global-font-tertiary-color) 0%, + fi-var(global-font-tertiary-color) 40%, + fi-var(global-font-color) 50%, + fi-var(global-font-tertiary-color) 60%, + fi-var(global-font-tertiary-color) 100% + ); + background-size: 200% 100%; + background-clip: text; + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + animation: disclaimer-shimmer 3s linear infinite; + @include media('reduce-motion') { + animation: none; + } + + [dir="rtl"] & { + animation-name: disclaimer-shimmer-rtl; + } + } + + .icon { + flex-shrink: 0; + padding-inline: 0.125em; + color: fi-var(global-font-secondary-color); + } + + svg.icon { + width: 1.25em; + height: 1.25em; + } +} diff --git a/assets/scss/pages/posts/_index.scss b/assets/scss/pages/posts/_index.scss index c5488473..a9780543 100644 --- a/assets/scss/pages/posts/_index.scss +++ b/assets/scss/pages/posts/_index.scss @@ -1,4 +1,5 @@ @use "collections"; +@use "disclaimer"; @use "footer"; @use "related"; @use "toc"; diff --git a/hugo.toml b/hugo.toml index 22d94b5a..bab196de 100644 --- a/hugo.toml +++ b/hugo.toml @@ -728,6 +728,16 @@ end_level = 6 # Whether to decrease the H1 heading level in content. decrease_h1 = false +# Post disclaimer/declaration. +[params.disclaimer] +# Whether to enable the disclaimer. +enable = false +# Disclaimer type. +# available values: ["ai", "repost", "original", "custom"] +type = "ai" +# Custom disclaimer content (optional, uses i18n default if empty). +content = "" + # Display a message at the beginning of an article to warn the reader that its content might be expired. [params.expiration_reminder] enable = false diff --git a/i18n/ar.toml b/i18n/ar.toml index ba3804b2..24839ebb 100644 --- a/i18n/ar.toml +++ b/i18n/ar.toml @@ -125,6 +125,7 @@ other = "مشاركة على" # === Single Post === [single] contents = "المحتويات" +disclaimer = "تنبيه: " pin = "تثبيت في الأعلى" repost = "إعادة النشر" publishedOnDate = "نُشر في {{ .Date }}" @@ -147,6 +148,11 @@ password = "كلمة المرور" enterBtn = "دخول" encryptyAgain = "تشفير مرة أخرى" encryptionWarning = "تم اكتشاف تشفير المحتوى، لكنه لا يزال بنص عادي!" + +[single.disclaimerMessage] +ai = "تم إنشاء هذا المقال بواسطة الذكاء الاصطناعي. يرجى التحقق من المعلومات بشكل مستقل." +repost = "هذا المقال هو إعادة نشر. يرجى زيارة المصدر الأصلي لمزيد من المعلومات." +original = "هذا هو المحتوى الأصلي للمؤلف." encryptionCommand = "قم بتشغيل `npx @hugo-fixit/encrypt` بعد البناء لتشفيره فعلياً." relatedContent = "محتوى ذي صلة" diff --git a/i18n/de.toml b/i18n/de.toml index 7563d475..be7348c5 100644 --- a/i18n/de.toml +++ b/i18n/de.toml @@ -124,6 +124,7 @@ other = "Teilen auf" # === Single Post === [single] contents = "Inhalt" +disclaimer = "Autorenhinweis: " pin = "Oben anheften" repost = "Erneut posten" publishedOnDate = "veröffentlicht an {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Eintreten" encryptyAgain = "Erneut verschlüsseln" encryptionWarning = "Inhaltsverschlüsselung erkannt, aber sie sind noch im Klartext!" encryptionCommand = "Führen Sie `npx @hugo-fixit/encrypt` nach dem Build aus, um sie tatsächlich zu verschlüsseln." + +[single.disclaimerMessage] +ai = "Dieser Artikel wurde von einer KI generiert. Bitte überprüfen Sie die Informationen unabhängig." +repost = "Dieser Artikel ist ein Repost. Bitte besuchen Sie die Originalquelle für weitere Informationen." +original = "Dies ist der Originalinhalt des Autors." relatedContent = "Ähnliche Inhalte" [single.includedIn] diff --git a/i18n/en.toml b/i18n/en.toml index c0b4cef7..aecbcc93 100644 --- a/i18n/en.toml +++ b/i18n/en.toml @@ -124,6 +124,7 @@ other = "Share on" # === Single Post === [single] contents = "Contents" +disclaimer = "Disclaimer: " pin = "Pin to top" repost = "Repost" publishedOnDate = "published on {{ .Date }}" @@ -149,6 +150,11 @@ encryptionWarning = "Content encryption detected, but they are still in plaintex encryptionCommand = "Run `npx @hugo-fixit/encrypt` after building to actually encrypt them." relatedContent = "Related Content" +[single.disclaimerMessage] +ai = "This article was generated by AI. Please verify the information independently." +repost = "This article is a repost. Please visit the original source for more information." +original = "This is original content by the author." + [single.includedIn] categories = "included in {{ .Categories }}" collections = "included in {{ .Collections }}" diff --git a/i18n/es.toml b/i18n/es.toml index 6775d501..704663c8 100644 --- a/i18n/es.toml +++ b/i18n/es.toml @@ -124,6 +124,7 @@ other = "Compartir en" # === Single Post === [single] contents = "Contenido" +disclaimer = "Aviso: " pin = "Fijar en la parte superior" repost = "Repostear" publishedOnDate = "publicado el {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Entrar" encryptyAgain = "Encriptar de nuevo" encryptionWarning = "¡Se detectó cifrado de contenido, pero aún están en texto plano!" encryptionCommand = "Ejecute `npx @hugo-fixit/encrypt` después de la compilación para cifrarlos realmente." + +[single.disclaimerMessage] +ai = "Este artículo fue generado por IA. Por favor, verifique la información de forma independiente." +repost = "Este artículo es un repost. Por favor, visite la fuente original para más información." +original = "Este es el contenido original del autor." relatedContent = "Contenido relacionado" [single.includedIn] diff --git a/i18n/fa.toml b/i18n/fa.toml index d70c3d28..438fba0a 100644 --- a/i18n/fa.toml +++ b/i18n/fa.toml @@ -125,6 +125,7 @@ other = "اشتراکگذاری در" # === Single Post === [single] contents = "فهرست مطالب" +disclaimer = "بیانیه نویسنده: " pin = "سنجاق کردن به بالا" repost = "بازنشر" publishedOnDate = "منتشر شده در {{ .Date }}" @@ -147,6 +148,11 @@ password = "رمز عبور" enterBtn = "ورود" encryptyAgain = "رمزنگاری مجدد" encryptionWarning = "رمزنگاری محتوا شناسایی شد، اما هنوز به صورت متن ساده هستند!" + +[single.disclaimerMessage] +ai = "این مقاله توسط هوش مصنوعی تولید شده است. لطفاً اطلاعات را به طور مستقل تأیید کنید." +repost = "این مقاله یک بازنشر است. لطفاً برای اطلاعات بیشتر به منبع اصلی مراجعه کنید." +original = "این محتوای اصلی نویسنده است." encryptionCommand = "پس از ساخت، دستور `npx @hugo-fixit/encrypt` را اجرا کنید تا واقعاً رمزنگاری شوند." relatedContent = "مطالب مرتبط" diff --git a/i18n/fr.toml b/i18n/fr.toml index ae6c46b3..379c75fa 100644 --- a/i18n/fr.toml +++ b/i18n/fr.toml @@ -124,6 +124,7 @@ other = "Partager via" # === Single Post === [single] contents = "Contenus" +disclaimer = "Avertissement : " pin = "Épingler en haut" repost = "Reposter" publishedOnDate = "publié le {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Entrer" encryptyAgain = "Chiffrer à nouveau" encryptionWarning = "Chiffrement de contenu détecté, mais ils sont toujours en texte clair !" encryptionCommand = "Exécutez `npx @hugo-fixit/encrypt` après la compilation pour les chiffrer réellement." + +[single.disclaimerMessage] +ai = "Cet article a été généré par une IA. Veuillez vérifier les informations de manière indépendante." +repost = "Cet article est un repost. Veuillez visiter la source originale pour plus d'informations." +original = "Ceci est le contenu original de l'auteur." relatedContent = "Contenu lié" [single.includedIn] diff --git a/i18n/hi.toml b/i18n/hi.toml index c827648a..89fdfaff 100644 --- a/i18n/hi.toml +++ b/i18n/hi.toml @@ -125,6 +125,7 @@ other = " शेयर करें" # === Single Post === [single] contents = "सामग्री" +disclaimer = "लेखक का बयान: " pin = "शीर्ष पर पिन करें" repost = "दोबारा पोस्ट करें" publishedOnDate = "{{ .Date }} पर प्रकाशित" @@ -150,6 +151,11 @@ encryptionWarning = "सामग्री एन्क्रिप्शन क encryptionCommand = "उन्हें वास्तव में एन्क्रिप्ट करने के लिए बिल्ड के बाद `npx @hugo-fixit/encrypt` चलाएं।" relatedContent = "संबंधित सामग्री" +[single.disclaimerMessage] +ai = "यह लेख AI द्वारा उत्पन्न किया गया था। कृपया जानकारी को स्वतंत्र रूप से सत्यापित करें।" +repost = "यह लेख एक पुनर्प्रकाशन है। कृपया अधिक जानकारी के लिए मूल स्रोत पर जाएं।" +original = "यह लेखक की मूल सामग्री है।" + [single.includedIn] categories = "{{ .Categories }} में शामिल" collections = "{{ .Collections }} में शामिल" diff --git a/i18n/it.toml b/i18n/it.toml index b8bc9745..a0afa918 100644 --- a/i18n/it.toml +++ b/i18n/it.toml @@ -124,6 +124,7 @@ other = "Condividi su" # === Single Post === [single] contents = "Contenuti" +disclaimer = "Avvertenza: " pin = "Fissa in alto" repost = "Ripubblica" publishedOnDate = "pubblicato su {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Entra" encryptyAgain = "Crittografa di nuovo" encryptionWarning = "Rilevata crittografia dei contenuti, ma sono ancora in testo in chiaro!" encryptionCommand = "Eseguire `npx @hugo-fixit/encrypt` dopo la compilazione per crittograffarli effettivamente." + +[single.disclaimerMessage] +ai = "Questo articolo è stato generato da un'IA. Si prega di verificare le informazioni in modo indipendente." +repost = "Questo articolo è un repost. Si prega di visitare la fonte originale per maggiori informazioni." +original = "Questo è il contenuto originale dell'autore." relatedContent = "Contenuti correlati" [single.includedIn] diff --git a/i18n/ja.toml b/i18n/ja.toml index 85bed649..713fdc84 100644 --- a/i18n/ja.toml +++ b/i18n/ja.toml @@ -122,6 +122,7 @@ other = "共有先" # === Single Post === [single] contents = "目次" +disclaimer = "著者声明:" pin = "ピン留め" repost = "再投稿" publishedOnDate = "公開日 {{ .Date }}" @@ -147,6 +148,11 @@ encryptionWarning = "コンテンツの暗号化が検出されましたが、 encryptionCommand = "実際に暗号化するには、ビルド後に `npx @hugo-fixit/encrypt` を実行してください。" relatedContent = "関連コンテンツ" +[single.disclaimerMessage] +ai = "この記事はAIによって生成されました。情報を独自に確認してください。" +repost = "この記事は転載です。詳細は元のソースをご覧ください。" +original = "この記事は作者のオリジナルコンテンツです。" + [single.includedIn] categories = "カテゴリに収録:{{ .Categories }}" collections = "コレクションに収録:{{ .Collections }}" diff --git a/i18n/ko.toml b/i18n/ko.toml index 58e6c3a6..58676b4e 100644 --- a/i18n/ko.toml +++ b/i18n/ko.toml @@ -122,6 +122,7 @@ other = "공유하기" # === Single Post === [single] contents = "목차" +disclaimer = "작성자 성명: " pin = "고정" repost = "재게시" publishedOnDate = "발행일: {{ .Date }}" @@ -147,6 +148,11 @@ encryptionWarning = "콘텐츠 암호화가 감지되었지만 여전히 평문 encryptionCommand = "실제로 암호화하려면 빌드 후 `npx @hugo-fixit/encrypt`를 실행하세요." relatedContent = "관련 콘텐츠" +[single.disclaimerMessage] +ai = "이 글은 AI에 의해 생성되었습니다. 정보를 독립적으로 확인하시기 바랍니다." +repost = "이 글은 전재 콘텐츠입니다. 자세한 내용은 원문을 방문하시기 바랍니다." +original = "이 글은 저자의 오리지널 콘텐츠입니다." + [single.includedIn] categories = "{{ .Categories }}에 포함" collections = "{{ .Collections }}에 포함" diff --git a/i18n/pl.toml b/i18n/pl.toml index f75c207f..e0298979 100644 --- a/i18n/pl.toml +++ b/i18n/pl.toml @@ -124,6 +124,7 @@ other = "Udostępnij na" # === Single Post === [single] contents = "Spis treści" +disclaimer = "Ostrzeżenie: " pin = "Przypnij na górze" repost = "Prześlij ponownie" publishedOnDate = "opublikowano {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Wejdź" encryptyAgain = "Zaszyfruj ponownie" encryptionWarning = "Wykryto szyfrowanie treści, ale nadal są w postaci zwykłego tekstu!" encryptionCommand = "Uruchom `npx @hugo-fixit/encrypt` po kompilacji, aby je faktycznie zaszyfrować." + +[single.disclaimerMessage] +ai = "Ten artykuł został wygenerowany przez AI. Proszę samodzielnie zweryfikować informacje." +repost = "Ten artykuł jest repostem. Proszę odwiedzić oryginalne źródło, aby uzyskać więcej informacji." +original = "To jest oryginalna treść autora." relatedContent = "Powiązane treści" [single.includedIn] diff --git a/i18n/pt-BR.toml b/i18n/pt-BR.toml index 74f33bdf..cd7a8d7f 100644 --- a/i18n/pt-BR.toml +++ b/i18n/pt-BR.toml @@ -125,6 +125,7 @@ other = "Compartilhar em" # === Single Post === [single] contents = "Conteúdos" +disclaimer = "Aviso: " pin = "Fixar no topo" repost = "Repostar" publishedOnDate = "publicado em {{ .Date }}" @@ -147,6 +148,11 @@ password = "Senha" enterBtn = "Entrar" encryptyAgain = "Encripte novamente" encryptionWarning = "Criptografia de conteúdo detectada, mas ainda estão em texto plano!" + +[single.disclaimerMessage] +ai = "Este artigo foi gerado por IA. Por favor, verifique as informações de forma independente." +repost = "Este artigo é um repost. Por favor, visite a fonte original para mais informações." +original = "Este é o conteúdo original do autor." encryptionCommand = "Execute `npx @hugo-fixit/encrypt` após a compilação para realmente criptografá-los." relatedContent = "Conteúdo relacionado" diff --git a/i18n/ro.toml b/i18n/ro.toml index 4bc5fde6..426d7040 100644 --- a/i18n/ro.toml +++ b/i18n/ro.toml @@ -124,6 +124,7 @@ other = "Distribuie pe" # === Single Post === [single] contents = "Cuprins" +disclaimer = "Notificare: " pin = "Fixează în partea de sus" repost = "Repostează" publishedOnDate = "publicat la {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Intră" encryptyAgain = "Criptează din nou" encryptionWarning = "Criptarea conținutului a fost detectată, dar sunt încă în text clar!" encryptionCommand = "Rulați `npx @hugo-fixit/encrypt` după compilare pentru a le cripta efectiv." + +[single.disclaimerMessage] +ai = "Acest articol a fost generat de AI. Vă rugăm să verificați informațiile în mod independent." +repost = "Acest articol este o repostare. Vă rugăm să vizitați sursa originală pentru mai multe informații." +original = "Acesta este conținutul original al autorului." relatedContent = "Conținut înrudit" [single.includedIn] diff --git a/i18n/ru.toml b/i18n/ru.toml index 97e90c30..fe23ee3b 100644 --- a/i18n/ru.toml +++ b/i18n/ru.toml @@ -124,6 +124,7 @@ other = "Поделиться в" # === Single Post === [single] contents = "Содержание" +disclaimer = "Заявление автора: " pin = "Закрепить наверху" repost = "Перепостить" publishedOnDate = "Опубликовано {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Войти" encryptyAgain = "Зашифровать снова" encryptionWarning = "Обнаружено шифрование контента, но он всё ещё в открытом виде!" encryptionCommand = "Запустите `npx @hugo-fixit/encrypt` после сборки, чтобы фактически зашифровать их." + +[single.disclaimerMessage] +ai = "Эта статья была сгенерирована ИИ. Пожалуйста, проверьте информацию самостоятельно." +repost = "Эта статья является репостом. Пожалуйста, посетите оригинальный источник для получения дополнительной информации." +original = "Это оригинальный контент автора." relatedContent = "Связанный контент" [single.includedIn] diff --git a/i18n/sr.toml b/i18n/sr.toml index 5bc3be98..337db090 100644 --- a/i18n/sr.toml +++ b/i18n/sr.toml @@ -124,6 +124,7 @@ other = "Подели на" # === Single Post === [single] contents = "Садржаји" +disclaimer = "Obavetenje: " pin = "Закачи" repost = "Поново објави" publishedOnDate = "објављено {{ .Date }}" @@ -147,6 +148,11 @@ enterBtn = "Унеси" encryptyAgain = "Поново шифруј" encryptionWarning = "Детектовано је шифровање садржаја, али су и даље у обичном тексту!" encryptionCommand = "Покрените `npx @hugo-fixit/encrypt` након изградње да бисте их заиста шифровали." + +[single.disclaimerMessage] +ai = "Овај чланак је генерисан од стране вештачке интелигенције. Молимо вас да независно проверите информације." +repost = "Овај чланак је репост. Молимо вас да посетите оригинални извор за више информација." +original = "Ово је оригинални садржај аутора." relatedContent = "Повезани садржај" [single.includedIn] diff --git a/i18n/ur.toml b/i18n/ur.toml index 195b3979..54c09be7 100644 --- a/i18n/ur.toml +++ b/i18n/ur.toml @@ -125,6 +125,7 @@ other = "پر شیئر کریں" # === Single Post === [single] contents = "مواد" +disclaimer = "Tafheem: " pin = "اوپر پن کریں" repost = "دوبارہ شائع کریں" publishedOnDate = "{{ .Date }} کو شائع ہوا" @@ -147,6 +148,11 @@ password = "پاس ورڈ" enterBtn = "داخل ہوں" encryptyAgain = "دوبارہ انکرپٹ کریں" encryptionWarning = "مواد کی انکرپشن کا پتہ چلا، لیکن یہ ابھی بھی سادہ متن میں ہے!" + +[single.disclaimerMessage] +ai = "یہ مضمون AI کے ذریعے تیار کیا گیا تھا۔ براہ کرم معلومات کو آزادانہ طور پر تصدیق کریں۔" +repost = "یہ مضمون ایک دوبارہ شائع کردہ ہے۔ براہ کرم مزید معلومات کے لیے اصل ذریعہ پر جائیں۔" +original = "یہ مصنف کا اصل مواد ہے۔" encryptionCommand = "انکرپشن کے لیے بلڈ کے بعد `npx @hugo-fixit/encrypt` چلائیں۔" relatedContent = "متعلقہ مواد" diff --git a/i18n/vi.toml b/i18n/vi.toml index 0af35d70..b88ec218 100644 --- a/i18n/vi.toml +++ b/i18n/vi.toml @@ -123,6 +123,7 @@ other = "Chia sẻ trên" # === Single Post === [single] contents = "Nội dung" +disclaimer = "Tuyên bố của tác giả: " pin = "Ghim ở đầu trang" repost = "Đăng lại" publishedOnDate = "đăng ngày {{ .Date }}" @@ -148,6 +149,11 @@ encryptionWarning = "Phát hiện mã hóa nội dung, nhưng chúng vẫn ở d encryptionCommand = "Chạy `npx @hugo-fixit/encrypt` sau khi build để thực sự mã hóa chúng." relatedContent = "Nội dung liên quan" +[single.disclaimerMessage] +ai = "Bài viết này được tạo bởi AI. Vui lòng xác minh thông tin một cách độc lập." +repost = "Bài viết này là nội dung được đăng lại. Vui lòng truy cập nguồn gốc để biết thêm thông tin." +original = "Đây là nội dung gốc của tác giả." + [single.includedIn] categories = "trong {{ .Categories }}" collections = "trong {{ .Collections }}" diff --git a/i18n/zh-CN.toml b/i18n/zh-CN.toml index e41f4043..77f10105 100644 --- a/i18n/zh-CN.toml +++ b/i18n/zh-CN.toml @@ -122,6 +122,7 @@ other = "分享到" # === Single Post === [single] contents = "目录" +disclaimer = "作者声明:" pin = "置顶" repost = "转载" publishedOnDate = "发布于 {{ .Date }}" @@ -147,6 +148,11 @@ encryptionWarning = "检测到内容加密,但仍为明文状态!" encryptionCommand = "请在构建后执行 `npx @hugo-fixit/encrypt` 以实际加密内容。" relatedContent = "相关内容" +[single.disclaimerMessage] +ai = "本文由 AI 生成,请注意甄别内容真实性。" +repost = "本文为转载内容,请访问原文了解更多信息。" +original = "本文为作者原创内容。" + [single.includedIn] categories = "收录于 {{ .Categories }}" collections = "收录于 {{ .Collections }}" diff --git a/i18n/zh-TW.toml b/i18n/zh-TW.toml index b862967e..4babbf44 100644 --- a/i18n/zh-TW.toml +++ b/i18n/zh-TW.toml @@ -122,6 +122,7 @@ other = "分享到" # === Single Post === [single] contents = "目錄" +disclaimer = "作者聲明:" pin = "置頂" repost = "轉貼" publishedOnDate = "發佈於 {{ .Date }}" @@ -147,6 +148,11 @@ encryptionWarning = "偵測到內容加密,但仍為明文狀態!" encryptionCommand = "請在建構後執行 `npx @hugo-fixit/encrypt` 以實際加密內容。" relatedContent = "相關內容" +[single.disclaimerMessage] +ai = "本文由 AI 生成,請注意甄別內容真實性。" +repost = "本文為轉載內容,請訪問原文了解更多信息。" +original = "本文為作者原創內容。" + [single.includedIn] categories = "收錄於 {{ .Categories }}" collections = "收錄於 {{ .Collections }}" diff --git a/layouts/_partials/single/disclaimer.html b/layouts/_partials/single/disclaimer.html new file mode 100644 index 00000000..54d9904e --- /dev/null +++ b/layouts/_partials/single/disclaimer.html @@ -0,0 +1,38 @@ +{{- /* + Post disclaimer/declaration partial. + + Displays a lightweight disclaimer notice at the beginning of an article. + Supports multiple types: ai, ai-assisted, ai-translated, repost, original, custom. + The "custom" type requires content to be specified, otherwise it will not be displayed. +*/ -}} + +{{- $disclaimer := dict "Page" . "Key" "disclaimer" | partial "function/param.html" | default dict -}} + +{{- if $disclaimer.enable -}} + {{- $type := $disclaimer.type | default "ai" -}} + {{- $content := "" -}} + + {{- if eq $type "custom" -}} + {{- /* custom type requires content, otherwise skip */ -}} + {{- $content = $disclaimer.content | default "" -}} + {{- else -}} + {{- $content = $disclaimer.content | default (T (printf "single.disclaimerMessage.%s" $type)) -}} + {{- end -}} + + {{- if $content -}} + {{- $types := slice "ai" "repost" "original" -}} + {{- $iconSrc := "" -}} + {{- if in $types $type -}} + {{- $iconSrc = printf "images/icons/disclaimer/%v.svg" $type -}} + {{- end -}} + +