Giscus Comment provides a seamless way to integrate GitHub-based comments directly into your website. With this feature, you can enhance user engagement and foster discussions by embedding Giscus comments effortlessly.
This easy-to-use embedding solution ensures that the GitHub commenting system becomes an integral part of your website, enriching the user experience and building a strong community around your content.
Dưới đây là cách cài đặt Giscus vào theme TanaFlows.
Bước #1: Tạo cấu hình Giscus của riêng bạn
Hãy làm theo hướng dẫn chính thức của Giscus để tạo cấu hình comment riêng. Tóm lại, bạn sẽ cần:
- Tài khoản GitHub với một repository public mới
- Cấp quyền cho Giscus app truy cập repository
- Bật tính năng Discussions trong repository
- Tạo thành công cấu hình Giscus
Sau khi hoàn tất, bạn sẽ nhận được đoạn script như sau:
<script src="https://giscus.app/client.js"
data-repo="[ENTER REPO HERE]"
data-repo-id="[ENTER REPO ID HERE]"
data-category="[ENTER CATEGORY NAME HERE]"
data-category-id="[ENTER CATEGORY ID HERE]"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="1"
data-emit-metadata="0"
data-input-position="bottom"
data-theme="preferred_color_scheme"
data-lang="en"
crossorigin="anonymous"
async>
</script>
Quan trọng: ghi lại 4 dòng cấu hình
Bạn cần lấy 4 giá trị sau:
data-repo="[ENTER REPO HERE]"data-repo-id="[ENTER REPO ID HERE]"data-category="[ENTER CATEGORY NAME HERE]"data-category-id="[ENTER CATEGORY ID HERE]"
Bước #2: Chọn Giscus trong theme TanaFlows
Trong Ghost Dashboard:
Settings → Design & branding → Customizer → Post → Comment provider
Ở mục comment provider thứ 3, dán 4 dòng trên thành một dòng duy nhất:
data-repo="..." data-repo-id="..." data-category="..." data-category-id="..."
Ví dụ:
data-repo="CuongGhost/giscus" data-repo-id="MDExxxx2MDc1MDA=" data-category="Announcements" data-category-id="DIC_kwDxxx"
Kết quả
Sau khi cấu hình xong, hệ thống sẽ render thành:
<script src="https://giscus.app/client.js"
data-repo="CuongGhost/giscus"
data-repo-id="MDEwOlJlcG9zaXRvcnk0MDU2MDc1MDA="
data-category="Announcements"
data-category-id="DIC_kwDOGC0UTM4B_BkD"
data-mapping="pathname"
data-strict="0"
data-reactions-enabled="0"
data-emit-metadata="0"
data-input-position="top"
data-theme="light"
data-loading="lazy"
crossorigin="anonymous"
async>
</script>
Nếu bạn muốn, tôi có thể giúp bạn rút gọn thành checklist hoặc viết lại thành doc hướng dẫn onboarding cho user TanaFlows luôn.
Bình luận