@@ -14,11 +14,12 @@ export async function setupAddons(projectDir: string, addons: ProjectAddons[]) {
1414 }
1515
1616 if ( addons . includes ( "SEO" ) ) {
17- log . info (
18- pc . yellow (
19- "SEO feature is still a work-in-progress and will be available in a future update." ,
20- ) ,
21- ) ;
17+ // log.info(
18+ // pc.yellow(
19+ // "SEO feature is still a work-in-progress and will be available in a future update.",
20+ // ),
21+ // );
22+ await setupSEO ( projectDir ) ;
2223 }
2324}
2425
@@ -180,3 +181,105 @@ jobs:
180181 deployWorkflowContent ,
181182 ) ;
182183}
184+
185+ async function setupSEO ( projectDir : string ) {
186+ const robotsContent = `# Instructions: Customize this file to control how search engines crawl your site
187+ # Learn more: https://developers.google.com/search/docs/advanced/robots/create-robots-txt
188+
189+ # Allow all crawlers (default)
190+ User-agent: *
191+ Allow: /
192+
193+ # Disallow crawling of specific directories (uncomment and customize as needed)
194+ # Disallow: /admin/
195+ # Disallow: /private/
196+
197+ # Specify the location of your sitemap
198+ Sitemap: https://yourdomain.com/sitemap.xml
199+ ` ;
200+
201+ await fs . writeFile (
202+ path . join ( projectDir , "packages" , "client" , "robots.txt" ) ,
203+ robotsContent ,
204+ ) ;
205+
206+ const sitemapContent = `<?xml version="1.0" encoding="UTF-8"?>
207+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
208+
209+ <url>
210+ <loc>https://yourdomain.com/</loc>
211+ <lastmod>2025-03-01</lastmod>
212+ <changefreq>weekly</changefreq>
213+ <priority>1.0</priority>
214+ </url>
215+
216+ <url>
217+ <loc>https://yourdomain.com/about</loc>
218+ <lastmod>2025-03-01</lastmod>
219+ <changefreq>monthly</changefreq>
220+ <priority>0.8</priority>
221+ </url>
222+
223+ </urlset>
224+ ` ;
225+ await fs . writeFile (
226+ path . join ( projectDir , "packages" , "client" , "sitemap.xml" ) ,
227+ sitemapContent ,
228+ ) ;
229+
230+ const metaContent = `<!doctype html>
231+ <html lang="en">
232+
233+ <head>
234+ <meta charset="UTF-8" />
235+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
236+ <title>TanStack Router</title>
237+ <meta name="description"
238+ content="Replace this with your page description - keep it between 150-160 characters for optimal display in search results." />
239+ <meta name="keywords" content="keyword1, keyword2, keyword3, customize based on your content" />
240+ <meta name="robots" content="index, follow" />
241+ <link rel="icon" href="/favicon.ico" />
242+ <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
243+ <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
244+ <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
245+
246+ <!-- OPEN GRAPH TAGS: Optimize how your content appears when shared on Facebook, LinkedIn, etc. -->
247+ <meta property="og:title" content="Replace with your page title" />
248+ <meta property="og:description"
249+ content="Replace with your page description (typically the same as meta description)" />
250+ <meta property="og:image" content="path-to-image" />
251+ <meta property="og:type" content="website" />
252+ <meta property="og:site_name" content="Your Site Name" />
253+
254+ <!-- TWITTER CARD TAGS: Optimize how your content appears when shared on Twitter -->
255+ <meta name="twitter:card" content="summary_large_image" />
256+ <meta name="twitter:title" content="Replace with your page title" />
257+ <meta name="twitter:description" content="Replace with your page description" />
258+ <meta name="twitter:image" content="path-to-image" />
259+ <meta name="twitter:creator" content="@yourtwitterhandle" />
260+
261+ <!-- STRUCTURED DATA: Help search engines understand your content better (JSON-LD format) -->
262+ <script type="application/ld+json">
263+ {
264+ "@context": "https://schema.org",
265+ "@type": "WebPage",
266+ "name": "Replace with your page title",
267+ "description": "Replace with your page description",
268+ "url": "https://yourdomain.com/your-page-url"
269+ }
270+ </script>
271+ </head>
272+
273+ <body>
274+ <div id="app"></div>
275+ <script type="module" src="/src/main.tsx"></script>
276+ </body>
277+
278+ </html>
279+ ` ;
280+
281+ await fs . writeFile (
282+ path . join ( projectDir , "packages" , "client" , "index.html" ) ,
283+ metaContent ,
284+ ) ;
285+ }
0 commit comments