Skip to content

fix: pin SEO URLs to code-echo.pages.dev on both hosts - #63

Merged
assertion merged 2 commits into
masterfrom
cursor/canonical-domain-seo-99f1
Oct 10, 2026
Merged

assertion merged 2 commits into
masterfrom
cursor/canonical-domain-seo-99f1

Conversation

@assertion

@assertion assertion commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Summary

GitHub Pages was shipping relative canonical/hreflang/feed links, relative sitemap <loc> values (invalid), and a robots.txt with no Sitemap line. Cloudflare production was already fine because SITE_URL is injected at build time. This makes both builds emit absolute URLs pointing at the canonical host https://code-echo.pages.dev, so the GitHub Pages copy consolidates ranking signals to Cloudflare.

What changed

  • Set url: https://code-echo.pages.dev in _config.yml (local serve still overrides via _config_local.yml). Cloudflare preview should leave this as-is so preview hostnames are not indexed as a second origin; relative CSS/nav links keep previews browsable.
  • Shared _includes/absolute-origin.html fallback: if site.url is empty or is assertion.github.io, templates still emit the Cloudflare origin.
  • Custom sitemap.xml (Liquid) so GitHub Pages — which cannot run _plugins/ — still writes absolute <loc> values, keeps lastmod on posts, and omits empty paginator pages / 404 / the markdown test page.
  • robots.txt always includes Sitemap: https://code-echo.pages.dev/sitemap.xml on production builds.
  • Optional google_site_verification / bing_site_verification in _config.yml (empty). Rendered as google-site-verification and msvalidate.01 only when set.
  • hreflang="x-default" now always points at the ZH twin.
  • /404.html and /markdown are noindex + sitemap: false.

_posts/ untouched.

Verification (Jekyll 3.10 local builds)

Production (jekyll build --config _config.yml) — same committed url used by GitHub Pages and Cloudflare:

User-agent: *
Allow: /

Sitemap: https://code-echo.pages.dev/sitemap.xml
  • sitemap.xml: 63 absolute https://code-echo.pages.dev/... locs, 0 relative, 57 lastmods (all posts). Excluded /page4/, /markdown, /404.html. Kept /, /about, /categories/, /wiki/, /page2/, /page3/.
  • ZH post: <link rel="canonical" href="https://code-echo.pages.dev/2026/10/09/ai-twitter-hots" /> plus matching hreflang / og:url / feed / .md / JSON-LD.
  • EN post: hreflang="x-default" points at the ZH URL.
  • 404, /markdown, /page4/ each have robots=noindex.
  • Empty verification keys emit no meta tags. Overlay google_site_verification / bing_site_verification rendered google-site-verification and msvalidate.01.
Build canonical (2026-10-09 ZH) robots Sitemap
_config.yml (prod / GH / CF) https://code-echo.pages.dev/2026/10/09/ai-twitter-hots https://code-echo.pages.dev/sitemap.xml
+ _config_local.yml http://localhost:4000/2026/10/09/ai-twitter-hots http://localhost:4000/sitemap.xml
+ empty url: "" fallback https://code-echo.pages.dev/2026/10/09/ai-twitter-hots https://code-echo.pages.dev/sitemap.xml

After merge

  1. Paste Google / Bing verification codes into _config.yml when issued (google_site_verification, bing_site_verification).
  2. In Google Search Console and Bing Webmaster Tools, add https://code-echo.pages.dev as the property and submit https://code-echo.pages.dev/sitemap.xml. site: will stay empty until the property is verified and crawled.
  3. Cloudflare preview: do not overlay url with the preview hostname, or preview pages will advertise a second origin.

Noted, not changed

  • GitHub Pages still cannot run _plugins/, so plaintext .md copies are Cloudflare-only. After this change the rel=alternate markdown links on the GitHub Pages HTML point at the Cloudflare URLs, which do exist.
  • GitHub Pages https_enforced is currently off (http://assertion.github.io). Harmless once canonicals point at Cloudflare.
Open in Web Open in Cursor 

cursoragent and others added 2 commits October 10, 2026 18:36
Commit the Cloudflare Pages origin as site.url so GitHub Pages and
Cloudflare production both emit absolute canonical/hreflang/og/JSON-LD
and feed links. Add a Liquid sitemap and always-on robots Sitemap line
so GH Pages (no custom plugins) no longer ships relative <loc> values.

Co-authored-by: Aaron Xia <zhhuaxia@gmail.com>
Keep robots.txt and XML declarations free of leading blank lines, and
avoid Jekyll looking up a nonexistent "nil" layout for feed/sitemap.

Co-authored-by: Aaron Xia <zhhuaxia@gmail.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Deploying code-echo with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2d31964
Status: ✅  Deploy successful!
Preview URL: https://c7089680.code-echo.pages.dev
Branch Preview URL: https://cursor-canonical-domain-seo.code-echo.pages.dev

View logs

@assertion
assertion merged commit 5322be4 into master Oct 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants