With this setup, the Meta component receives the custom meta description and applies it to the page's metadata. If no custom value is passed, the default from `Meta.astro` will be used instead.
#### Extending Metadata for SEO
For a more robust SEO strategy, you can create additional properties in the `Meta.astro` component. For instance, you may want to include specific Open Graph tags for article publishing dates or tags for Twitter-specific metadata.
#### Structured Data and Rich Snippets
Structured data in JSON-LD format can be managed by the `Meta.astro` component, improving how search engines understand your page content and potentially enhancing search results with rich snippets. Modify the `structuredData` property with relevant [schema.org](https://schema.org) types and properties:
```astro
<MainLayout
structuredData={{
"@context": "https://schema.org",
"@type": "WebSite",
"name": "ScrewFast",
"url": "https://screwfast.uk",
"description": "Discover top-quality hardware tools and services"
}}
>
While the template provides a custom SEO solution, you may choose to utilize an Astro integration such as Astro SEO for additional SEO features and optimizations. Integrating such a package might provide more automated metadata management and additional SEO-focused functionality.
robots.txt
is dynamically generated using the code found in src/pages/robots.txt.ts. This configuration follows the example from the Astro Docs:
import type { APIRoute } from 'astro';
const robotsTxt = `
User-agent: *
Allow: /
Sitemap: ${new URL('sitemap-index.xml', import.meta.env.SITE).href}
`.trim();
export const GET: APIRoute = () => {
return new Response(robotsTxt, {
headers: {
'Content-Type': 'text/plain; charset=utf-8',
},
});
};
The addition of .vscode/settings.json
file in the root directory facilitates image integration directly into content collections within Markdown editors. This feature enables effortless creation of Markdown links with media files and seamless copying into the workspace.
- Paste/Drop Images: Activate by pressing Shift while dropping the file.
- Markdown Link: Image is linked using Markdown syntax
()
. - File Handling: Images are organized in
src/images/content/<path>
.
Pasting getting-started.png
into src/content/post-1.md
results in:
- Adding

topost-1.md
. - Moving the image file to
src/images/content/post-1/getting-started.png
.
Note
Remember to press Shift while dropping images.
Maximize your website's efficiency with these built-in Astro integrations:
- Astro Compressor: Automatically compresses Astro-generated site using gzip or brotli, ensuring faster load times.
Configure the compressor in
astro.config.mjs
file:
export default defineConfig({
// ...other Astro configurations
integrations: [...other Astro integrations, compressor({ gzip: false, brotli: true })],
});
- Astro Sitemap: Automatically generates a sitemap for a website, which is vital for SEO and helping search engine bots crawl pages effectively. To set up the Astro Sitemap, be sure to specify your site's base URL and any additional options in
astro.config.mjs
file:
export default defineConfig({
// ...
site: 'https://example.com',
integrations: [sitemap()],
});
- Bag of Tricks for Astro's View Transitions: is a collection of extensions and support aimed at enhancing Astro's view transitions. Whether you're looking to add flair to your website or streamline user experience, this toolkit offers various techniques to elevate your projects. In the template, it was used to add View Transitions to a Starlight docs.
The great thing about Astro is its rich ecosystem of integrations, allowing you to tailor project functionalities to your exact needs. Feel free to explore Astro integrations page and add additional capabilities as you see fit.
This project is built using a variety of tools and technologies that enhance its performance, maintainability, and developer experience. Below is a list of the key tools and their roles in the project:
Interactive components like navbars, modals, and accordions are built using Preline UI, a comprehensive open-source component library.
Styling across our project leverages the utility-first classes offered by Tailwind CSS. This methodology allows us to create custom layouts and components with speed and efficiency.
To ensure consistent code formatting, particularly for class sorting, we have integrated the prettier-plugin-tailwindcss
plugin. The following configuration is set in the .prettierrc
file at the root of the project:
{
"plugins": ["prettier-plugin-tailwindcss"]
}
We deploy our project on Vercel, capitalizing on their robust platform for seamless CI/CD workflows. Using vercel.json
, we set stringent security headers and caching policies, ensuring adherence to security and performance best practices:
{
"headers": [
{
"source": "/(.*)",
"headers": [
{
"key": "Content-Security-Policy",
"value": "default-src 'self'; [other-directives]"
},
"Additional security headers..."
]
}
]
}
For optimal site performance, we post-process our HTML files with process-html.mjs
, a custom script that minifies HTML after the build phase to reduce file size and improve load times.
Here is a snippet from our HTML minification script in process-html.mjs
:
/process-html.mjs
// Post-build HTML minification script snippet
// ...
await Promise.all(
files.map(async (file) => {
// File processing and minification logic
})
);
We encourage you to refer to the detailed documentation for each tool to fully understand their capabilities and how they contribute to the project:
- Preline UI Documentation
- Tailwind CSS Documentation
- Vercel Documentation
- html-minifier Documentation
If you're interested in helping, you can contribute in several ways:
- Reporting Issues: Feel free to use the issue tracker to report bugs or request features.
- Submitting Pull Requests: If you've fixed a bug or added a new feature, submit a pull request with a clear description of your changes.
- Providing Feedback: Share your thoughts on the project's current features and suggest improvements.
This project is released under the MIT License. Please read the LICENSE file for more details. -->