Skip to content

Commit

Permalink
feat: config robots-txt, sitemap
Browse files Browse the repository at this point in the history
  • Loading branch information
ardasevinc committed Oct 10, 2023
1 parent 6580199 commit d048494
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
10 changes: 6 additions & 4 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { defineConfig } from 'astro/config';
import tailwind from '@astrojs/tailwind';

import sitemap from "@astrojs/sitemap";
import robotsTxt from 'astro-robots-txt';
import robotsConfig from './robots-txt.config';
import sitemap from '@astrojs/sitemap';

// https://astro.build/config
export default defineConfig({
integrations: [tailwind(), sitemap()]
});
site: 'https://iztechai.com',
integrations: [tailwind(), robotsTxt(robotsConfig), sitemap()],
});
20 changes: 20 additions & 0 deletions robots-txt.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { RobotsTxtOptions } from 'astro-robots-txt';
import siteConfig from './site.config';

const robotsConfig: RobotsTxtOptions = {
policy: [
{
userAgent: '*',
// The next line enables or disables the crawling on the `robots.txt` level
disallow: siteConfig.disableIndexing ? '/' : '',
},
],
sitemapBaseFileName: 'sitemap-index', // default 'sitemap-index'
// transform(content) {
// const commentsList = ['Some text before main content', 'Second line', 'Third line'];
// const comments = commentsList.map((item) => `# ${item}.`).join('\n');
// return `${comments}\n\n${content}`;
// },
};

export default robotsConfig;
3 changes: 3 additions & 0 deletions site.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default {
disableIndexing: false,
};

0 comments on commit d048494

Please sign in to comment.