Skip to content

Commit

Permalink
Merge pull request #301 from MelihDarcanxyz/main
Browse files Browse the repository at this point in the history
Automatic robots.txt / webmanifest generation
  • Loading branch information
chrismwilliams authored Sep 23, 2024
2 parents 38ef738 + 9a13029 commit e23dcbe
Show file tree
Hide file tree
Showing 15 changed files with 426 additions and 41 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ Astro Cactus is a simple opinionated starter built with the Astro framework. Use
- Pagination
- [Automatic RSS feed](https://docs.astro.build/en/guides/rss)
- [Webmentions](https://webmention.io/)
- Auto-generated [sitemap](https://docs.astro.build/en/guides/integrations-guide/sitemap/)
- Auto-generated:
- [sitemap](https://docs.astro.build/en/guides/integrations-guide/sitemap/)
- [robots.txt](https://github.com/alextim/astro-lib/blob/main/packages/astro-robots-txt/README.md)
- [web app manifest](https://github.com/alextim/astro-lib/blob/main/packages/astro-webmanifest/README.md)
- [Pagefind](https://pagefind.app/) static search library integration
- [Astro Icon](https://github.com/natemoo-re/astro-icon) svg icon component
- [Expressive Code](https://expressive-code.com/) source code and syntax highlighter
Expand Down Expand Up @@ -84,11 +87,12 @@ Replace pnpm with your choice of npm / yarn

- Edit the config file `src/site.config.ts` for basic site meta data
- Read [this post](http://astro-cactus.chriswilliams.dev/posts/webmentions/) for adding webmentions to your site, otherwise set `siteConfig.webmentions.link` to an empty value.
- Update file `astro.config.ts` site property with your own domain.
- Update file `astro.config.ts`
- **Important**: the site property with your own domain.
- [astro-webmanifest options](https://github.com/alextim/astro-lib/blob/main/packages/astro-webmanifest/README.md)
- Replace & update files within the `/public` folder:
- favicon.ico & other social icons
- robots.txt - update the Sitemap url to your own domain
- manifest.webmanifest
- icon.svg - used as the source to create favicons & manifest icons
- social-card.png - used as the default og:image
- Modify file `src/styles/global.css` with your own light and dark styles.
- You can also modify the theme(s) for markdown code blocks generated by [Expressive Code](https://expressive-code.com). Astro Cactus has both a dark (dracula) and light (github-light) theme, which can be found in `src/site.config.ts`. You can find more theme(s) and options [here](https://expressive-code.com/guides/themes/#available-themes).
- Edit social links in `src/components/SocialList.astro` to add/replace your media profile. Icons can be found @ [icones.js.org](https://icones.js.org/), per [Astro Icon's instructions](https://www.astroicon.dev/guides/customization/#find-an-icon-set).
Expand Down Expand Up @@ -147,7 +151,7 @@ You may want to track the number of visitors you receive to your blog/website in

This theme/template doesn't include a specific solution due to there being a number of use cases and/or options which some people may or may not use.

You may be asked to included a snippet inside the **HEAD** tag of your website when setting it up, which can be found in `src/layouts/Base.astro`. Alternatively, you could add the snippet in `src/components/BaseHead.astro`.
You may be asked to included a snippet inside the **HEAD** tag of your website when setting it up, which can be found in `src/layouts/Base.astro`. Alternatively, you can add the snippet in `src/components/BaseHead.astro`.

## Deploy

Expand Down
44 changes: 44 additions & 0 deletions astro.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import expressiveCode from "astro-expressive-code";
import icon from "astro-icon";
import robotsTxt from "astro-robots-txt";
import webmanifest from "astro-webmanifest";
import { defineConfig } from "astro/config";
import { expressiveCodeOptions } from "./src/site.config";
import { siteConfig } from "./src/site.config";

// Remark plugins
import remarkDirective from "remark-directive"; /* Handle ::: directives as nodes */
Expand All @@ -30,6 +33,47 @@ export default defineConfig({
}),
sitemap(),
mdx(),
robotsTxt(),
webmanifest({
// See: https://github.com/alextim/astro-lib/blob/main/packages/astro-webmanifest/README.md
/**
* required
**/
name: siteConfig.title,
/**
* optional
**/
// short_name: "Astro_Cactus",
description: siteConfig.description,
lang: siteConfig.lang,
icon: "public/icon.svg", // the source for generating favicon & icons
icons: [
{
src: "icons/apple-touch-icon.png", // used in src/components/BaseHead.astro L:26
sizes: "180x180",
type: "image/png",
},
{
src: "icons/icon-192.png",
sizes: "192x192",
type: "image/png",
},
{
src: "icons/icon-512.png",
sizes: "512x512",
type: "image/png",
},
],
start_url: "/",
background_color: "#1d1f21",
theme_color: "#2bbc8a",
display: "standalone",
config: {
insertFaviconLinks: false,
insertThemeColorMeta: false,
insertManifestLink: false,
},
}),
],
markdown: {
rehypePlugins: [
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"astro": "4.14.3",
"astro-expressive-code": "^0.35.6",
"astro-icon": "^1.1.1",
"astro-robots-txt": "^1.0.0",
"astro-webmanifest": "^1.0.0",
"cssnano": "^7.0.5",
"hastscript": "^9.0.0",
"mdast-util-directive": "^3.0.0",
Expand Down
Loading

0 comments on commit e23dcbe

Please sign in to comment.