Abdelkad3r/cybersecurityelite.com
GitHub: Abdelkad3r/cybersecurityelite.com
一个基于Hugo和PaperMod主题的网络安全博客全栈模板,内置安全类短代码、企业级SEO和自动化部署流程,帮助安全从业者快速搭建专业的技术内容站点。
Stars: 0 | Forks: 0
# CyberSecurity Elite
[](https://github.com/cybersecurityelite/cybersecurityelite.com/actions/workflows/hugo.yml)
**在线站点:** https://cybersecurityelite.com
## 包含内容
- **Hugo extended** 静态站点生成器 + **PaperMod** 主题
- **20 篇高质量示例文章**,涵盖 CTF writeups、Web 安全、恶意软件分析、电子取证、云安全和认证
- **自定义 shortcodes**,用于提示框、终端块、CVSS 徽章、CTF 元数据、Mermaid 图表和下载
- **企业级 SEO**: JSON-LD (Organization, WebSite, BlogPosting, BreadcrumbList)、Open Graph、Twitter cards、站点地图、robots、规范 URL
- **深色 / 浅色模式**,移动端优先,基于 PaperMod 的无障碍友好 CSS
- 每次 push 到 `main` 分支时自动构建和部署的 **GitHub Actions** 工作流
- **CNAME、manifest、browserconfig、favicons、Open Graph image** — 均已提供
## 快速开始
### 前置条件
- [Hugo extended](https://gohugo.io/installation/) **≥ 0.140.0**
- [Git](https://git-scm.com/) (带子模块支持)
- [Node.js 20+](https://nodejs.org/) (用于 Pagefind — 搜索索引生成)
- (可选) ImageMagick — 仅在生成每篇文章的 OG 图片库时需要
### 克隆并在本地运行
```
git clone --recurse-submodules https://github.com/cybersecurityelite/cybersecurityelite.com.git
cd cybersecurityelite.com
# 如果你在没有 submodules 的情况下已经 clone:
git submodule update --init --recursive
hugo server -D
```
打开 — 站点将支持热重载实时预览。
### 添加 PaperMod (首次设置)
如果您在没有子模块的情况下 fork 或下载了此代码库,请安装主题:
```
git submodule add --depth=1 https://github.com/adityatelange/hugo-PaperMod.git themes/PaperMod
git submodule update --init --recursive
```
## 项目结构
```
cybersecurityelite.com/
├── .github/workflows/hugo.yml # CI/CD: build + deploy to Pages
├── archetypes/ # Front-matter templates
├── assets/css/extended/custom.css # Custom theme overrides
├── content/ # Articles, sections, pages
│ ├── _index.md # Home page metadata
│ ├── about.md, contact.md, ... # Static pages
│ ├── posts/ # General posts section
│ ├── ctf-writeups/ # CTF walkthroughs
│ ├── tutorials/ # Hands-on tutorials
│ ├── tools/ # Tool deep-dives
│ ├── certifications/ # Cert prep
│ ├── malware-analysis/ # Malware analysis
│ ├── reverse-engineering/ # RE tutorials
│ ├── forensics/ # DFIR
│ ├── bug-bounty/ # Bug bounty
│ ├── cloud-security/ # AWS / Azure / GCP
│ ├── web-security/ # OWASP, XSS, SQLi
│ ├── network-security/ # AD, Wireshark, pivoting
│ ├── career/ # Career advice
│ └── news/ # CVE coverage, trends
├── layouts/ # Custom layouts & partials
│ ├── 404.html # Custom 404
│ ├── partials/ # Head, footer, hero, schema
│ └── shortcodes/ # callout, terminal, cvss, ctf-meta, ...
├── static/ # CNAME, robots, manifest, logos
│ ├── CNAME # cybersecurityelite.com
│ ├── robots.txt
│ ├── humans.txt
│ ├── logo.svg, favicon.svg
│ └── images/og-default.svg
├── themes/PaperMod/ # Git submodule
├── hugo.toml # Site config
├── .gitignore
├── .gitmodules
└── README.md
```
## 创建内容
### 新的 CTF Writeup
```
hugo new ctf-writeups/my-machine-walkthrough.md
```
自动使用 `archetypes/ctf-writeups.md`,其中包含 CTF 元数据 shortcode 和章节标题的预设。
### 常规文章
```
hugo new tutorials/my-tutorial.md
```
使用 `archetypes/default.md`。编辑 front matter,设置 `draft: false`,然后添加内容。
### Front Matter 参考
```
---
title: "Article title (SEO-optimized, ≤ 60 chars)"
slug: "url-slug"
description: "Meta description, 150-160 chars."
date: 2026-05-12T10:00:00Z
lastmod: 2026-05-12T10:00:00Z
draft: false
author: "Author Name"
categories: ["Web Security"]
tags: ["xss", "appsec"]
series: ["OWASP Top 10 Series"]
keywords: ["xss tutorial", "stored xss"]
weight: 1
canonicalURL: ""
toc: true
cover:
image: "/images/og-default.svg"
alt: "Cover alt text"
---
```
### 自定义 Shortcodes
```
{{< callout type="info" title="Heads up" >}}
Multi-line **markdown** inside a callout.
Types: info, tip, warning, danger.
{{< /callout >}}
{{< terminal title="kali@kali" >}}
$ nmap -sC -sV 10.10.10.10
{{< /terminal >}}
{{< cvss score="9.8" vector="AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H" >}}
{{< ctf-meta platform="Hack The Box" difficulty="Easy" os="Linux" points="20" release="2024-03-15" skills="Web, AD" >}}
{{< downloads title="Lab Files" >}}
[exploit.py](/files/exploit.py) | 4 KB
[capture.pcap](/files/capture.pcap) | 2.1 MB
{{< /downloads >}}
{{< mermaid >}}
graph LR; Attacker-->Beacon-->C2;
{{< /mermaid >}}
{{< faq >}}
- q: "What is Kerberoasting?"
a: "An Active Directory attack that requests TGS tickets for service accounts..."
- q: "Which encryption type is most vulnerable?"
a: "RC4-HMAC (etype 23). Move to AES-only on service accounts."
{{< /faq >}}
{{< howto title="How to enable AS-REP Roasting detection" duration="PT15M" >}}
- name: "Enable Event ID 4769 logging on Domain Controllers"
text: "Configure the Advanced Audit Policy to capture Kerberos Service Ticket Operations."
- name: "Build a Splunk detection"
text: "Alert when a single user requests 5+ TGS tickets with `Ticket_Encryption_Type=0x17` in 10 minutes."
{{< /howto >}}
```
`{{< faq >}}` 和 `{{< howto >}}` shortcodes 会同时输出渲染后的 HTML **和**有效的 JSON-LD `FAQPage` / `HowTo` schema — 符合 Google 富媒体搜索结果的要求。
对于 Mermaid,请在页面的 front matter 中添加 `mermaid: true`,以便注入加载器。
## 作者与 E-E-A-T
作者元数据位于 [`data/authors.yaml`](./data/authors.yaml),以文章 front matter 中的
`author:` 字符串作为键进行索引。每个条目会生成:
- **个人资料页面**,路径为 `/authors/{slug}/` (Markdown 内容位于
`content/authors/`)
- **包含 `jobTitle`、`description`、`image`、`sameAs` 和 `knowsAbout` 的 Person JSON-LD** — 这正是 Google 评估的 E-E-A-T 信号
- 在他们撰写的每篇文章中**丰富 BlogPosting 的 `author` 字段**
添加新作者的步骤:
1. 在 `data/authors.yaml` 中添加一个 YAML 键(使用文章 `author:` 字段中确切的字符串)。
2. 创建 `content/authors/{slug}.md`,包含 `layout: "author"` 和 `authorKey: "..."`。
3. 文章的 `author: "..."` 值将自动链接到该资料页并继承其 schema。
## 搜索 (Pagefind)
搜索功能由 [Pagefind](https://pagefind.app/) 提供 — 这是一个基于渲染后的 HTML 构建的静态站点搜索索引。无需 JavaScript 框架,无第三方服务,在包含 25 篇文章的站点上响应时间约为 50ms。
**本地开发:**
```
hugo --gc --minify # build the site
npx pagefind --site public # build the search index
# 或者一起运行它们:
npm run build
```
对于使用 `hugo server` 的开发环境,搜索功能将无法使用,因为 Pagefind 需要构建后的 `public/` 目录。请运行完整构建来测试搜索功能。
**CI:** GitHub Actions 工作流会安装 Node 20,并在 Hugo 构建之后自动运行 `npx pagefind`。
## 按文章生成 OG 图片
默认情况下,每篇文章使用 `/images/og-default.svg` 作为其 Open Graph 卡片。
为了获得更高的点击率和更好的 SEO,您可以为每篇文章启用自动生成的独立 OG 卡片 — 将标题 + 板块 + URL 合成到品牌基础底图上。
一次性设置:
```
# 1. 创建基础画布(1200×630,无文本 — 见 assets/og/README.md)
convert -background "#000000" -density 144 \
static/images/og-default.svg \
-resize 1200x630! \
assets/og/base.png
# 2. 下载字体
curl -L -o assets/og/font.ttf \
https://github.com/rsms/inter/raw/master/docs/font-files/Inter-Bold.ttf
```
当这两个文件存在后,每篇文章将自动在 `/og/...png` 获得一张独特的 1200×630 OG 图片。Front-matter 中的 `cover.image` 可按文章覆盖此默认行为。
## 部署
### GitHub Pages (默认)
1. 创建一个 GitHub 仓库。
2. 将此代码推送到 `main` 分支。
3. 在 **Settings → Pages** 中,设置 **Source = GitHub Actions**。
4. `.github/workflows/hugo.yml` 中的工作流将在每次推送时自动构建并发布。
自定义域名来源于 `static/CNAME`(Hugo 会将其复制到构建输出中)。首次部署后,请配置您的 DNS:
```
A @ 185.199.108.153
A @ 185.199.109.153
A @ 185.199.110.153
A @ 185.199.111.153
CNAME www .github.io.
```
一旦 DNS 生效,请在仓库 Settings → Pages 中启用 **"Enforce HTTPS"**。
## 使用 Cloudflare 进行域名设置 (推荐)
为了获得更好的性能、安全性和分析能力:
1. 将域名添加到 Cloudflare (免费计划即可)。
2. 将 Cloudflare DNS 的顶级记录设置为 **Proxied** (橙色云朵)。
3. SSL/TLS 模式: **Full (strict)**。
4. 配置以下规则:
- **Always Use HTTPS** — 开启
- **HSTS** — Max-Age 12 个月,includeSubDomains, preload
- **Automatic HTTPS Rewrites** — 开启
- **Brotli** — 开启
- **Auto Minify**: HTML 开启, CSS/JS 关闭 (Hugo 已经进行了压缩)
- **Caching Level** — Standard
- **Browser Cache TTL** — 4 小时
5. 启用 **Cloudflare Bot Fight Mode**。
6. 在域名注册商处配置 DNSSEC。
### 推荐的安全响应头 (通过 Cloudflare Transform Rules)
```
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), microphone=(), camera=()
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' https://www.googletagmanager.com https://www.google-analytics.com; img-src 'self' data: https:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; connect-src 'self' https://www.google-analytics.com; frame-ancestors 'none'; base-uri 'self';
X-Frame-Options: DENY
```
在您最终确定实际使用的分析/嵌入工具后,请进一步收紧 CSP 策略。
## SEO 检查清单
上线前:
- [ ] 将 `hugo.toml` 中的 `REPLACE_WITH_GSC_TOKEN` 替换为您的 Google Search Console 验证 token
- [ ] 将 `REPLACE_WITH_BING_TOKEN` 替换为您的 Bing Webmaster Tools token
- [ ] 将 `G-XXXXXXXXXX` 替换为您的 GA4 Measurement ID (或移除 `services.googleAnalytics` 代码块以禁用 GA4)
- [ ] 将 `REPLACE_WITH_CLARITY_ID` 替换为您的 Microsoft Clarity 项目 ID (或移除以禁用)
- [ ] 将 `https://cybersecurityelite.com/sitemap.xml` 提交到 Google Search Console
- [ ] 将站点地图提交到 Bing Webmaster Tools
- [ ] 在 GitHub Pages 前配置 Cloudflare,以实现 HTTPS 和边缘缓存
- [ ] 使用 [opengraph.xyz](https://www.opengraph.xyz/) 验证 Open Graph 渲染效果
- [ ] 在 [Schema Validator](https://validator.schema.org/) 验证结构化数据
- [ ] 在主页上运行 Lighthouse 测试 — 目标是各项得分均 ≥ 95
- [ ] 将站点添加到 Cloudflare Web Analytics 或 Plausible
持续进行:
- [ ] 每周至少发布一篇实质性文章
- [ ] 定期运行死链检查
- [ ] 每季度重新测试移动端易用性
- [ ] 在 Search Console 中监控 Core Web Vitals
- [ ] 每次修改文章时更新 `lastmod`
## 分析与监控
代码库接入了四种分析工具 — 全部为可选,且默认关闭:
| 服务 | 启用方法 | 隐私说明 |
|---------|---------------|---------------|
| Google Analytics 4 | 在 `hugo.toml` 中将 `ga4` / `services.googleAnalytics.ID` 设置为您的 `G-XXXX` ID | 加载带有 `anonymize_ip: true` 的 gtag |
| Plausible | 设置 `plausibleDomain` 并取消 `layouts/partials/extend_footer.html` 中 `