用於 AI 搜尋的頁面結構審核程式碼片段(標題、清單、表格、FAQ)
A console snippet to audit page structure for AI search (headings, lists, tables, FAQ)
這段可貼入瀏覽器控制台的程式碼片段會檢查網頁的標題層級、疑問式標題、編號清單、表格及 FAQ 線索,並輸出結構審核結果。文章建議按內容補上清晰標題、步驟清單、比較表和 FAQ,讓 AI 搜尋引擎更容易找到頁面段落。
AI search engines like ChatGPT, Perplexity and Google's AI Overviews pull passages from pages, not whole pages. A clear structure makes those passages easy to find: question-style headings, numbered lists for steps, comparison tables, and a short FAQ.
Structure matters more than you might think. In an October 2025 analysis, Ahrefs found that 28.3% of the 1,000 pages ChatGPT cites most had no organic keywords on Google.
Here is a small snippet you can paste in the browser console to get a quick structural audit of any page.
The snippet
// Paste in the browser console on any page.
// Prints a quick structure audit: H1 count, headings, question headings, lists, tables, FAQ hints.
(() => {
const q = (s) => [...document.querySelectorAll(s)];
const heads = q('h1, h2, h3').map((h) => ({
level: h.tagName,
text: h.innerText.trim().slice(0, 90),
question: /\?\s*$/.test(h.innerText.trim()),
}));
const faqHeading = heads.some((h) => /faq|frequently asked/i.test(h.text));
const faqSchema = q('script[type="application/ld+json"]').some((s) => /FAQPage/.test(s.textContent));
const summary = {
h1: q('h1').length,
headings: heads.length,
questionHeadings: heads.filter((h) => h.question).length,
orderedLists: q('main ol, article ol').length,
tables: q('main table, article table').length,
faqHeading,
faqSchema,
};
console.table(heads);
console.table([summary]);
return summary;
})();
It scopes lists and tables to main and article so navigation menus don't inflate the count. If your theme uses neither, change the selectors.
How to read the output
-
h1should be 1. Zero means no main heading; more than one usually means a template issue. -
Read the
headingstable top to bottom. It should work as a table of contents of the questions the page answers. -
questionHeadings: not every heading needs a question mark, but section headings that mirror real customer questions ("How long does it last?") are easier to match. -
orderedLists: if the page explains a process and this is 0, the steps are probably buried in paragraphs. -
tables: if the page compares options and this is 0, consider a comparison table: one row per criterion, one column per option. -
faqHeading/faqSchema: an FAQ with 4 to 8 real questions and short answers helps. FAQPage markup is a bonus; the value is in the answers.
Fixing a page
- Turn vague headings ("Overview", "Our approach") into questions or clear topics.
- Turn step-by-step paragraphs into a numbered list.
- Add a comparison table where people choose between options.
- Add an FAQ: 4 to 8 real customer questions, two or three sentences each.
Then re-run the snippet.
The method is lesson 5.2 of our free AEO and GEO course: Structure: headings, lists, tables.
I'm Adrian, founder of CiteProof.
來源:DEV Community · dev.to