-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat(blog): add blog system, sitemap automation, and cookie fixes #131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c88e3b6
c9e4acd
d268c94
a7a5834
a4fdd3d
07498fb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,64 +1 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" | ||
| xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" | ||
| xmlns:xhtml="http://www.w3.org/1999/xhtml"> | ||
|
|
||
| <!-- Homepage --> | ||
| <url> | ||
| <loc>https://refactron.dev/</loc> | ||
| <lastmod>2026-03-26</lastmod> | ||
| <changefreq>weekly</changefreq> | ||
| <priority>1.0</priority> | ||
| <image:image> | ||
| <image:loc>https://refactron.dev/Refactron-logo-TM.png</image:loc> | ||
| <image:title>Refactron - Safe, Verified Refactoring</image:title> | ||
| <image:caption>Safety-first refactoring tool that analyzes code structure and proposes incremental, reviewable changes with verification</image:caption> | ||
| </image:image> | ||
| </url> | ||
|
|
||
| <!-- About Page --> | ||
| <url> | ||
| <loc>https://refactron.dev/about</loc> | ||
| <lastmod>2026-03-26</lastmod> | ||
| <changefreq>monthly</changefreq> | ||
| <priority>0.7</priority> | ||
| </url> | ||
|
|
||
| <!-- Case Studies --> | ||
| <url> | ||
| <loc>https://refactron.dev/case-studies</loc> | ||
| <lastmod>2026-03-26</lastmod> | ||
| <changefreq>weekly</changefreq> | ||
| <priority>0.8</priority> | ||
| <image:image> | ||
| <image:loc>https://refactron.dev/Refactron-logo-TM.png</image:loc> | ||
| <image:title>Refactron Case Studies - Real Code Transformations</image:title> | ||
| <image:caption>Real transformations from engineering teams using safety-first refactoring</image:caption> | ||
| </image:image> | ||
| </url> | ||
|
|
||
| <!-- Case Study: Legacy Code AI Refactoring (Actual Data) --> | ||
| <url> | ||
| <loc>https://refactron.dev/case-studies/legacy-code-ai-refactoring</loc> | ||
| <lastmod>2026-03-26</lastmod> | ||
| <changefreq>monthly</changefreq> | ||
| <priority>0.7</priority> | ||
| </url> | ||
|
|
||
| <!-- Privacy Policy --> | ||
| <url> | ||
| <loc>https://refactron.dev/privacy-policy</loc> | ||
| <lastmod>2026-03-26</lastmod> | ||
| <changefreq>monthly</changefreq> | ||
| <priority>0.4</priority> | ||
| </url> | ||
|
|
||
| <!-- Terms of Service --> | ||
| <url> | ||
| <loc>https://refactron.dev/terms-of-service</loc> | ||
| <lastmod>2026-03-26</lastmod> | ||
| <changefreq>monthly</changefreq> | ||
| <priority>0.4</priority> | ||
| </url> | ||
|
|
||
| </urlset> | ||
| <?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1"><url><loc>https://refactron.dev/</loc><changefreq>weekly</changefreq><priority>1.0</priority></url><url><loc>https://refactron.dev/blog</loc><changefreq>weekly</changefreq><priority>0.9</priority></url><url><loc>https://refactron.dev/about</loc><changefreq>monthly</changefreq><priority>0.6</priority></url><url><loc>https://refactron.dev/changelog</loc><changefreq>weekly</changefreq><priority>0.7</priority></url><url><loc>https://refactron.dev/security</loc><changefreq>monthly</changefreq><priority>0.5</priority></url><url><loc>https://refactron.dev/privacy-policy</loc><changefreq>yearly</changefreq><priority>0.3</priority></url><url><loc>https://refactron.dev/terms-of-service</loc><changefreq>yearly</changefreq><priority>0.3</priority></url><url><loc>https://refactron.dev/blog/i-ran-refactron-on-djangos-codebase</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://refactron.dev/blog/refactron-vs-cursor-vs-codeant</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://refactron.dev/blog/why-we-built-verification-engine-first</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://refactron.dev/blog/legacy-code-ai-refactoring</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://refactron.dev/blog/refactron-on-requests-library</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://refactron.dev/blog/real-cost-of-not-refactoring</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://refactron.dev/blog/refactron-on-fastapi</loc><changefreq>monthly</changefreq><priority>0.8</priority></url><url><loc>https://refactron.dev/blog/how-to-safely-refactor-python-code-you-didnt-write</loc><changefreq>monthly</changefreq><priority>0.8</priority></url></urlset> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| const { SitemapStream, streamToPromise } = require('sitemap'); | ||
| const { Readable } = require('stream'); | ||
| const fs = require('fs'); | ||
| const path = require('path'); | ||
|
|
||
| const BASE_URL = 'https://refactron.dev'; | ||
|
|
||
| // Extract slugs from posts.ts via regex — no ts-node needed | ||
| const postsFile = fs.readFileSync( | ||
| path.join(__dirname, '../src/data/posts.ts'), | ||
| 'utf-8' | ||
| ); | ||
| const slugMatches = [...postsFile.matchAll(/slug:\s*['"]([^'"]+)['"]/g)]; | ||
| const blogSlugs = slugMatches.map(m => m[1]); | ||
|
|
||
| const staticRoutes = [ | ||
| { url: '/', changefreq: 'weekly', priority: 1.0 }, | ||
| { url: '/blog', changefreq: 'weekly', priority: 0.9 }, | ||
| { url: '/about', changefreq: 'monthly', priority: 0.6 }, | ||
| { url: '/changelog', changefreq: 'weekly', priority: 0.7 }, | ||
| { url: '/security', changefreq: 'monthly', priority: 0.5 }, | ||
| { url: '/privacy-policy', changefreq: 'yearly', priority: 0.3 }, | ||
| { url: '/terms-of-service',changefreq: 'yearly', priority: 0.3 }, | ||
|
Comment on lines
+16
to
+23
|
||
| // blog posts added dynamically below | ||
| ]; | ||
|
|
||
| const blogRoutes = blogSlugs.map(slug => ({ | ||
| url: `/blog/${slug}`, | ||
| changefreq: 'monthly', | ||
| priority: 0.8, | ||
| })); | ||
|
|
||
| async function generate() { | ||
| const links = [...staticRoutes, ...blogRoutes]; | ||
| const stream = new SitemapStream({ hostname: BASE_URL }); | ||
| const xml = await streamToPromise(Readable.from(links).pipe(stream)); | ||
|
|
||
| const outputPath = path.join(__dirname, '../public/sitemap.xml'); | ||
| fs.writeFileSync(outputPath, xml.toString()); | ||
| console.log( | ||
| `✓ Sitemap generated — ${blogSlugs.length} blog posts + ${staticRoutes.length} static routes → public/sitemap.xml` | ||
| ); | ||
| } | ||
|
|
||
| generate().catch(err => { | ||
| console.error('Sitemap generation failed:', err); | ||
| process.exit(1); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The added
sitemap@^9.0.1devDependency declares an engines requirement ofnode >=20.19.5(see package-lock), but this repo’s CI matrix includes Node 16.x and 18.x. This is likely to breaknpm ciand/ornpm run buildin those environments becauseprebuildruns the sitemap generator. Consider pinningsitemapto a version that supports the project’s supported Node versions, or updating the supported Node/CI matrix accordingly (and documenting it).