mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
fix small bugs and added add-on for github seo
This commit is contained in:
5
.changeset/long-days-fetch.md
Normal file
5
.changeset/long-days-fetch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"create-better-t-stack": minor
|
||||
---
|
||||
|
||||
added github seo add-on
|
||||
@@ -14,11 +14,12 @@ export async function setupAddons(projectDir: string, addons: ProjectAddons[]) {
|
||||
}
|
||||
|
||||
if (addons.includes("SEO")) {
|
||||
log.info(
|
||||
pc.yellow(
|
||||
"SEO feature is still a work-in-progress and will be available in a future update.",
|
||||
),
|
||||
);
|
||||
// log.info(
|
||||
// pc.yellow(
|
||||
// "SEO feature is still a work-in-progress and will be available in a future update.",
|
||||
// ),
|
||||
// );
|
||||
await setupSEO(projectDir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -180,3 +181,105 @@ jobs:
|
||||
deployWorkflowContent,
|
||||
);
|
||||
}
|
||||
|
||||
async function setupSEO(projectDir: string) {
|
||||
const robotsContent = `# Instructions: Customize this file to control how search engines crawl your site
|
||||
# Learn more: https://developers.google.com/search/docs/advanced/robots/create-robots-txt
|
||||
|
||||
# Allow all crawlers (default)
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
# Disallow crawling of specific directories (uncomment and customize as needed)
|
||||
# Disallow: /admin/
|
||||
# Disallow: /private/
|
||||
|
||||
# Specify the location of your sitemap
|
||||
Sitemap: https://yourdomain.com/sitemap.xml
|
||||
`;
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(projectDir, "packages", "client", "robots.txt"),
|
||||
robotsContent,
|
||||
);
|
||||
|
||||
const sitemapContent = `<?xml version="1.0" encoding="UTF-8"?>
|
||||
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
||||
|
||||
<url>
|
||||
<loc>https://yourdomain.com/</loc>
|
||||
<lastmod>2025-03-01</lastmod>
|
||||
<changefreq>weekly</changefreq>
|
||||
<priority>1.0</priority>
|
||||
</url>
|
||||
|
||||
<url>
|
||||
<loc>https://yourdomain.com/about</loc>
|
||||
<lastmod>2025-03-01</lastmod>
|
||||
<changefreq>monthly</changefreq>
|
||||
<priority>0.8</priority>
|
||||
</url>
|
||||
|
||||
</urlset>
|
||||
`;
|
||||
await fs.writeFile(
|
||||
path.join(projectDir, "packages", "client", "sitemap.xml"),
|
||||
sitemapContent,
|
||||
);
|
||||
|
||||
const metaContent = `<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>TanStack Router</title>
|
||||
<meta name="description"
|
||||
content="Replace this with your page description - keep it between 150-160 characters for optimal display in search results." />
|
||||
<meta name="keywords" content="keyword1, keyword2, keyword3, customize based on your content" />
|
||||
<meta name="robots" content="index, follow" />
|
||||
<link rel="icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
|
||||
|
||||
<!-- OPEN GRAPH TAGS: Optimize how your content appears when shared on Facebook, LinkedIn, etc. -->
|
||||
<meta property="og:title" content="Replace with your page title" />
|
||||
<meta property="og:description"
|
||||
content="Replace with your page description (typically the same as meta description)" />
|
||||
<meta property="og:image" content="path-to-image" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:site_name" content="Your Site Name" />
|
||||
|
||||
<!-- TWITTER CARD TAGS: Optimize how your content appears when shared on Twitter -->
|
||||
<meta name="twitter:card" content="summary_large_image" />
|
||||
<meta name="twitter:title" content="Replace with your page title" />
|
||||
<meta name="twitter:description" content="Replace with your page description" />
|
||||
<meta name="twitter:image" content="path-to-image" />
|
||||
<meta name="twitter:creator" content="@yourtwitterhandle" />
|
||||
|
||||
<!-- STRUCTURED DATA: Help search engines understand your content better (JSON-LD format) -->
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "https://schema.org",
|
||||
"@type": "WebPage",
|
||||
"name": "Replace with your page title",
|
||||
"description": "Replace with your page description",
|
||||
"url": "https://yourdomain.com/your-page-url"
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
`;
|
||||
|
||||
await fs.writeFile(
|
||||
path.join(projectDir, "packages", "client", "index.html"),
|
||||
metaContent,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -89,9 +89,9 @@ async function createTursoDatabase(dbName: string): Promise<TursoConfig> {
|
||||
async function writeEnvFile(projectDir: string, config?: TursoConfig) {
|
||||
const envPath = path.join(projectDir, "packages/server", ".env");
|
||||
const envContent = config
|
||||
? `TURSO_DATABASE_URL="${config.dbUrl}"
|
||||
? `TURSO_CONNECTION_URL="${config.dbUrl}"
|
||||
TURSO_AUTH_TOKEN="${config.authToken}"`
|
||||
: `TURSO_DATABASE_URL=
|
||||
: `TURSO_CONNECTION_URL=
|
||||
TURSO_AUTH_TOKEN=`;
|
||||
|
||||
await fs.writeFile(envPath, envContent);
|
||||
@@ -105,7 +105,7 @@ function displayManualSetupInstructions() {
|
||||
3. Get your database URL and authentication token
|
||||
4. Add these credentials to the .env file in packages/server/.env
|
||||
|
||||
TURSO_DATABASE_URL=your_database_url
|
||||
TURSO_CONNECTION_URL=your_database_url
|
||||
TURSO_AUTH_TOKEN=your_auth_token`);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user