Hướng dẫn về Hexo SEO

Cách làm SEO on một Hexo site — đó Node.js static site generator. Hexo outputs pure HTML so nội dung là crawlable on đó đầu tiên fetch, nhưng sitemaps, robots.txt, meta các mô tả, canonicals, dữ liệu có cấu trúc, và ổn định permalinks all phụ thuộc on plugin và config.

Xuất bản lần đầu: 26 thg 6, 2026 · Cập nhật lần cuối: 8 thg 8, 2026 · Advanced
Ngôn ngữ

Hexo là một Node.js static site generator: hexo generate compiles Markdown vào pure static HTML, so Googlebot đọc của bạn toàn bộ nội dung on đó đầu tiên fetch với không JavaScript kết xuất queue. đó là đó crawlability floor — nhưng đây là không finished SEO. Hầu hết default themes ship không sitemap, không robots.txt, không theo-post mô tả meta, không canonical, và không dữ liệu có cấu trúc; bạn thêm những với _config.yml settings, front quan trọng các trường, theme edits, và plugin (hexo-generator-sitemap, hexo-generator-robotstxt, hexo-generator-feed, hexo-abbrlink). Đó big traps là một sai url: trong _config.yml, đó date-based default permalink đó breaks links on rename, và auto-generated category/tag archives đó tạo thin duplicate nội dung. Cho Baidu-facing các trang, đó static output xóa một real crawling obstacle — though đó là không phải là bảo đảm of Baidu lập chỉ mục hoặc xếp hạng.

Tóm tắt — Hexo (hexo generate) emits pure static HTML, so của bạn nội dung là trong đầu tiên byte của phản hồi — không Web Kết xuất Service, không Wave 2 delay. đó crawlability floor, không finished SEO. Default themes ship không sitemap, không robots.txt, không theo-post mô tả meta, không canonical, và không dữ liệu có cấu trúc; bạn thêm them qua _config.yml, front quan trọng, theme template edits, và plugin (hexo-generator-sitemap, hexo-generator-robotstxt, hexo-generator-feed, hexo-abbrlink, hexo-indexnow). three traps đó thực ra bite: sai url: trong _config.yml breaks canonicals/sitemap/feed; date-based default permalink ties các URL để filenames so rename breaks links; và auto-generated category/tag archives tạo thin duplicate nội dung. cho Baidu-facing các trang static output là thực advantage.

Hexo static output là crawling advantage

hexo generate chạy của bạn Markdown và theme templates qua xây dựng step và ghi folder của finished HTML, CSS, và assets. SEO-relevant fact là Khi HTML tồn tại: tại xây dựng time, sau khi, cho mọi người — không theo yêu cầu, và không trong trình duyệt. Evidence for this claim The Hexo generate command builds static files into the configured public directory. Scope: Hexo generate command. Confidence: high · Verified: Hexo: Commands

Google mô tả một hai-phase xử lý cho JavaScript các trang: Wave 1 fetches đó thô HTML và indexes static nội dung immediately; Wave 2 là một deferred headless-Chromium kết xuất queue đó có thể take seconds để days. Hexo output skips Wave 2 hoàn toàn — mỗi trang là thô HTML on đó đầu tiên fetch. Google own hướng dẫn là blunt đó này là đó được khuyến nghị path: dynamic kết xuất đã là “a workaround and not a long-term solution… use server-side rendering, static rendering, or hydration as a solution,” (bản dịch) «một workaround và không một dài-term giải pháp… dùng máy chủ-side kết xuất, static kết xuất, hoặc hydration as một giải pháp,» và Hexo produces static kết xuất, một of đó three explicitly được khuyến nghị approaches.

Hai nhiều hơn wins fall out của điều này:

  • Crawlable links theo mặc định. Hexo templates emit đơn giản <a href> anchors trong static HTML, so they satisfy Google requirement đó links là real, crawlable URLs — không JavaScript-generated navigation để design khoảng.
  • Cheap để crawl. Static files phân phối từ một CDN có effectively zero máy chủ-processing cost theo yêu cầu, so Googlebot có thể crawl tại của nó được phép rate không có tripping crawl-rate throttling. As Gary Illyes put điều này, “if you are making expensive database calls, that’s going to cost the server a lot” (bản dịch) «nếu bạn là đang làm expensive database calls, đó là going để cost đó máy chủ một lot» — Hexo làm none.

caveat: zero render-blocking cho các crawler không phải giống nhau as zero render-blocking cho người dùng. Theme JS/CSS vẫn ảnh hưởng Core Web Vitals (nhiều hơn dưới).

Configure _config.yml đầu tiên — url: là big một

đặt những điều này global keys trước khi của bạn đầu tiên deploy:

url: https://yourdomain.com       # must match your live domain, with https://
permalink: :title/                # or :year/:month/:day/:title/ (the default)
title: Site Title
description: Global meta description fallback
author: Your Name
language: en
meta_generator: false             # removes the <meta name="generator" content="Hexo"> tag
  • url: là single phần lớn consequential setting. nó trang web configured base URL, mà themes và generators có thể sử dụng cho canonical tags, feeds, sitemaps, và pagination. sai giá trị có thể propagate vào những điều đó outputs. Evidence for this claim Hexo's url configuration supplies the website URL used by themes and generators. Scope: Exact downstream fields depend on the installed theme and plugins. Confidence: high · Verified: Hexo: Configuration
  • permalink: — default :year/:month/:day/:title/ produces date-based các URL đó look stale theo thời gian và tie slug để filename. Cleaner options là /:title/ hoặc /:category/:title/.
  • meta_generator: false strips Hexo generator fingerprint từ <head>.
  • Deploying để subdirectory? url: alone không phải đủ — đặt root: để subdirectory path cũng (e.g. root: /blog/). Hexo url_for helper xây dựng root-relative links, trong khi full_url_for prepends đầy đủ url: giá trị; nhận root: sai on subdirectory deploy và liên kết nội bộ, feeds, và sitemap entries end lên pointing tại domain root thay vì thực tế path.
  • Config precedence: trang web _config.yml sets base url/root/permalink các giá trị; theme own config (của nó bundled _config.yml, hoặc _config.<theme>.yml tại project root) layers on top cho display và template settings, nhưng không override trang web-cấp độ URL structure — theme có thể’t khắc phục sai url:.
  • Kiểm thử trong safe chế độ? hexo server --safe (hoặc hexo --safe) disables mỗi plugin và script, so output bạn’re viewing là bị thiếu của bạn sitemap, robots.txt, và bất kỳ SEO plugin tags. không sử dụng safe-chế độ preview để kiểm tra SEO output — chạy thông thường hexo generate đầu tiên.

Front quan trọng SEO controls (và Điều gì bị thiếu)

Native Hexo front quan trọng Bạn có thể rely on:

---
title: "Article Title for the <title> tag"
date: 2024-01-15
updated: 2024-06-01
tags: [tag1, tag2]
categories: [Category]
permalink: /custom-url/           # overrides the global pattern for this post
published: true
sitemap: false                    # exclude this post from sitemap.xml
---

Điều gì là không trong native front quan trọng và cần theme hỗ trợ hoặc template edit:

  • description ( mô tả meta) — phần lớn themes không print nó không có patch.
  • keywords (theo-post từ khóa meta) — và largely pointless anyway; Google có đã bỏ qua <meta name="keywords"> since 2009. Treat keywords as organizational aid, không xếp hạng lever.
  • canonical (override canonical URL) — theme-phụ thuộc.

giữ updated: trường hiện tại Khi bạn revise post — sitemap freshness phụ thuộc on nó (tiếp theo section).

Essential plugin

Sitemap — hexo-generator-sitemap (chính thức):

npm install hexo-generator-sitemap --save
sitemap:
  path:
    - sitemap.xml
  tags: true
  categories: true

Điều này đọc lastmod từ mỗi post updated trường (falling back để date) — mà matters vì Bing warns đó lastmod “should reflect the true last modification time of the page content, not the sitemap file itself.” (bản dịch) «nên reflect đó đúng cuối cùng modification time of đó trang nội dung, không đó sitemap file itself.» Sau hexo generate, submit đó resulting sitemap.xml trong Google Search Console và Bing Quản trị viên web Tools. Và heed Bing other warning: “Do not submit a static sitemap and forget it. New pages won’t get picked up” (bản dịch) «Không submit một static sitemap và forget điều này. New các trang sẽ không nhận picked lên» — cho Hexo đó có nghĩa là re-deploying và re-submitting (hoặc dùng IndexNow) sau mỗi new post.

robots.txt — hexo-generator-robotstxt:

npm install hexo-generator-robotstxt --save
robotstxt:
  useragent: "*"
  allow:
    - /
  disallow:
    - /private/
  sitemap: https://yourdomain.com/sitemap.xml

không có nó, Hexo produces không robots.txt tại all — không sitemap pointer cho các crawler.

RSS — hexo-generator-feed: relevant cho aggregators và Google News eligibility; John Mueller bao gồm RSS feed on his own static trang web.

IndexNow — hexo-indexnow: Bing khuyến nghị pairing sitemaps với IndexNow cho thực-time, URL-cấp độ submission. Drop generated mấu chốt file vào source/ so nó deploys as yourdomain.com/<key>.txt. Note Đây là cho Bing, Yandex, và others — không Google, mà không sử dụng IndexNow cho chung các trang.

default permalink có hai SEO các vấn đề: renaming Markdown file thay đổi URL (vì slug xuất hiện từ filename), và non-Latin các tiêu đề (Chinese, emoji) produce garbled các URL. hexo-abbrlink decouples URL từ filename by writing ổn định hash back vào front quan trọng:

npm install hexo-abbrlink --save
permalink: posts/:abbrlink/
abbrlink:
  alg: crc32    # crc16 or crc32
  rep: hex      # dec or hex

bạn nhận điều gì đó như /posts/3a9c2b1d/ đó survives file renames, category thay đổi, và date edits. underlying rule stands either way: sau khi URL là published, không thay đổi nó không có 301 chuyển hướng — rename không có một destroys giá trị liên kết và bất kỳ accumulated các tín hiệu xếp hạng.

Hai nhiều hơn permalink pitfalls worth knowing trước khi bạn pick pattern:

  • không sử dụng :id token. Hexo documents post IDs as không persistent trên database bộ nhớ đệm reset — nếu của bạn permalink pattern bao gồm :id, bộ nhớ đệm rebuild có thể silently thay đổi mỗi post URL. Stick để :title, :abbrlink, hoặc một ổn định token.
  • trailing_indextrailing_html là tách biệt controls, không một setting. Hexo pretty_urls config toggles them independently — một governs liệu trailing index.html là stripped từ generated links, khác liệu trailing slash là đã thêm. nếu những điều này không match Cách của bạn host thực ra resolves các URL (some hosts chuyển hướng /post để /post/, others không), Bạn có thể end lên với internal links, canonicals, và sitemap entries disagreeing với URL máy chủ thực ra phục vụ.

tiếp theo theme SEO configuration

tiếp theo là phần lớn-được sử dụng Hexo theme, configured trong _config.next.yml:

canonical: true                 # builds canonical from url: + page path

webmaster_tools:
  google: VERIFICATION_STRING
  bing: VERIFICATION_STRING
  baidu: VERIFICATION_STRING

open_graph:
  enable: true
  twitter_card: summary_large_image

** tiếp theo meta-mô tả khoảng trống:** tiếp theo không tự động inject theo-post <meta name="description"> từ front quan trọng description:. bạn patch theme head template để fall back từ page.description để trang web mô tả. Đây là single phần lớn phổ biến tiếp theo SEO miss. (tiếp theo làm hỗ trợ canonical: true và được xây dựng-trong Open Graph / Twitter Cards, so những điều đó ít nhất hoạt động sau khi enabled.)

cho non-tiếp theo themes, bạn thường tạo hoặc edit head một phần để emit og:title, og:description, og:image, og:url, và twitter:card — hỗ trợ varies widely by theme.

Ai owns mỗi tag Khi theme và plugin cả hai emit nó. theme được xây dựng-trong Open Graph/canonical hỗ trợ và all-trong-một plugin như hexo-seo (mà generates của nó own breadcrumb, trang web, và bài viết schema) có thể cả hai try để ghi giống nhau tag. Chuyển thành cả hai on produces duplicate hoặc conflicting <meta> tags, canonicals, hoặc JSON-LD chặn trong giống nhau <head>. Pick một layer as owner cho mỗi tag category — theme hoặc plugin, không cả hai — và disable corresponding feature on khác trước khi bạn ship.

Category và tag các trang: duplicate-nội dung trap

Hexo auto-generates archive trang cho mỗi category và mỗi tag, mỗi filled với post excerpts đó cũng xuất hiện on posts themselves. Tại quy mô đó hundreds của thin các trang competing cho giống nhau các truy vấn và diluting crawl attention. của bạn options:

  1. sitemap: false theo archive (impractical tại quy mô).
  2. Theme-cấp độ noindex on category/tag archive templates.
  3. giữ them được lập chỉ mục chỉ nếu category là genuine, curated topic hub với thực giá trị.
  4. Self-referencing canonical on mỗi paginated archive trang (trang 2 canonicalizes để itself, không trang 1).

Một caveat on option 2: dài-term noindex eventually làm Google dừng sau links on đó trang, so noindexing tag các trang có thể reduce crawling của posts đó là chỉ linked từ những điều đó tags. hãy đảm bảo such posts là reachable some khác way.

của bạn route inventory là bigger hơn source/. Category, tag, archive, và pagination các trang không come từ Markdown files — Hexo generator API là Điều gì thực ra tạo them, và themes hoặc plugin có thể register của họ own generators cũng. đó có nghĩ là crawlable URL surface có thể silently expand beyond Điều gì bạn’d expect từ browsing của bạn source/ folder. sau khi installing hoặc updating theme hoặc plugin, chạy hexo generate và diff route list trong public/ thay vì assuming bạn know mỗi URL Hexo là producing.

Dữ liệu có cấu trúc / JSON-LD

Hexo injects không dữ liệu có cấu trúc theo mặc định. Either thêm BlogPosting JSON-LD block để của bạn theme post template (headline, datePublished, dateModified, author, publisher, url) hoặc sử dụng all-trong-một plugin như hexo-seo đó generates breadcrumb, trang web, và bài viết schema cho bạn.

Core Web Vitals

Static output là fast, nhưng themes có thể undo đó. tiếp theo và nhiều themes bundle lớn JS/CSS và icon-font libraries (Font Awesome là frequent LCP/render-blocking culprit). Audit với Lighthouse, sau đó reach cho hexo-all-minifier (HTML/CSS/JS compression tại xây dựng time), hexo-lazyload-image, và defer/async on thứ ba-party scripts như phân tích và quảng cáo.

Targeting Baidu (Chinese-audience các trang)

Baidu crawler xử lý JavaScript poorly, so Hexo static HTML xóa một obstacle để Baidu phát hiện. Thêm baidu_site_verification trong tiếp theo, generate Baidu-format sitemap với hexo-generator-baidu-sitemap, và push các URL actively với hexo-submit-urls-to-search-engine. Một hosting note: GitHub các trang là blocked trong mainland China — sử dụng Gitee các trang, Cloudflare, hoặc Chinese CDN cho Baidu traffic.

Treat đó as crawlability advantage, không bảo đảm. Static HTML không by itself prove Baidu là discovering, lập chỉ mục, hoặc xếp hạng của bạn các trang — xác nhận thực tế crawl activity và lập chỉ mục status trực tiếp trong Baidu Ziyuan (Baidu quản trị viên web tools) rather hơn assuming static output alone secures visibility.

Deploying để GitHub các trang — SEO gotchas

  • đặt url: để của bạn trực tiếp address (custom domain với https://) trước khi đầu tiên deploy.
  • Put CNAME file trong source/ cho custom domains so nó không phải reset on mỗi hexo deploy.
  • Enforce HTTPS trong repo Settings → các trang sau khi DNS propagates.
  • Ưu tiên GitHub Actions workflow over hexo-deployer-git để tránh CNAME-reset các vấn đề.

Hexo so với. Hugo so với. Jekyll so với. Astro, Đối với SEO

All four ship pure static HTML, so đó indexability floor là giống hệt — có không framework-cấp độ SEO disadvantage trong Hexo. Đó differences là operational: Hugo (Go) xây dựng far nhanh hơn tại lớn quy mô và có một được xây dựng-trong sitemap; Jekyll là đó GitHub Các trang default; Astro ships zero JS theo mặc định qua islands. Hexo edge là một rich npm plugin ecosystem và một lớn Chinese-language community. Nội dung quality, không đó generator, decides thứ hạng — as Mueller đã nói of switching generators, “Will your site’s SEO suddenly explode? No. Also No.” (bản dịch) «Sẽ trang web của bạn SEO suddenly explode? Không. Cũng Không.»

cho cluster overview và khác generators, see Static trang web Generators; cho rộng hơn kết xuất picture, see JavaScript SEO.

Add an expert note

Pin an expert quote

New person? Create their unclaimed profile at /admin/experts/ → Pin a quote first.