SEO Strategy
Relevant source files
The following files were used as context for generating this wiki page:The SEO strategy for CertDb is centered around the Astro framework's static site generation capabilities, ensuring that all content is pre-rendered and easily crawlable by search engines. The strategy relies on a well-defined site structure, automatic sitemap generation, and a dynamic robots.txt file to guide search engine crawlers. The use of structured content collections further enhances the discoverability of certification and career path information.
The project utilizes the @astrolib/seo package, indicating an approach that likely includes structured data (like JSON-LD) and other SEO metadata enhancements, although specific implementation details for this package are not present in the provided files.
Sources: astro.config.ts, package.json:13, src/pages/robots.txt.ts
Core SEO Components
The SEO foundation is built on three main pillars: the Astro project configuration, a dynamically generated robots.txt file, and an automatically generated sitemap. These components work in concert to maximize search engine visibility.
This diagram illustrates the high-level interaction between the core SEO components.
Astro Configuration for SEO
The main Astro configuration file, astro.config.ts, is the starting point for the site's SEO strategy. It defines the canonical site URL and integrates the sitemap functionality.
Sources: astro.config.ts
Key Configuration
| Option | Value | Description |
|---|---|---|
site | https://certdb.cyberpath-hq.com | Sets the canonical URL for the entire site, which is crucial for sitemaps and robots.txt. |
integrations | sitemap() | Enables the @astrojs/sitemap integration, which automatically generates a sitemap during the build process. |
output | static | Configures the project to build as a fully static site, which is optimal for performance and crawlability. |
Sources: astro.config.ts:11, astro.config.ts:17, astro.config.ts:25
robots.txt Generation
The project dynamically generates a robots.txt file to instruct search engine crawlers. This is handled by an API route endpoint.
Sources: src/pages/robots.txt.ts
Logic and Flow
The src/pages/robots.txt.ts file exports a GET handler that constructs the robots.txt content. It allows all user agents to crawl the entire site and provides the direct URL to the sitemap index file. The sitemap URL is dynamically created using the site property from the Astro configuration.
The following diagram shows the process of generating the robots.txt file.
Sources: src/pages/robots.txt.ts:12-15
The generated robots.txt has the following structure:
User-agent: *
Allow: /
Sitemap: https://certdb.cyberpath-hq.com/sitemap-index.xml
Sources: src/pages/robots.ts:4-7
Sitemap and Content Indexing
The sitemap is automatically generated by the @astrojs/sitemap integration. It includes all static pages and dynamically generated pages, ensuring that all certification and career path pages are discoverable.
Sources: astro.config.ts:17, package.json:12
Dynamic Page Generation
For dynamic routes like career paths, the project uses Astro's getStaticPaths function to pre-build a page for each path. This function is essential for SEO as it ensures that each dynamically generated page has a static URL that can be included in the sitemap.
The getStaticPaths function in src/pages/career-paths/[path]/data.json.ts iterates over the CareerPathsList to generate a unique path for each career path.
This diagram shows how career path pages are generated and made available to the sitemap.
Content Structure
The site's content, particularly certifications, is managed through Astro's content collections. The schema defined in src/content.config.ts ensures that each certification has structured metadata like title, acronym, and career_paths. This structured approach is beneficial for SEO as it creates consistent and data-rich pages.
Sources: src/content.config.ts:6-19