- To get started, first install all necessary packages with
npm install, then run an initial build to make sure the setup worksnpm run build. - Next, you'll want to configure your site i18n setup (one language, or multiple). Follow instructions in the i18n documentation.
- Now you can setup the site to your liking!
Should you need any assistance, send me a message at support@cosmicthemes.com
I have created a few code tours to help introduce you to the codebase. You will need the extension Code Tour to view them in VSCode.
The source files have the following setup. Note that not all files are included - it is already long, no one wants it to be longer.
.
├── .tours/
│ └── code-intro.tour
├── .vscode/
│ └── extensions.json
├── public/
│ ├── favicons/
│ │ └── favicon.ico
│ ├── images/
│ └── robots.txt
├── src/
│ ├── assets/
│ │ └── images/
│ │ └── hero.jpg
│ ├── components/
│ │ ├── Hero/
│ │ │ ├── HeroBgImage.astro
│ │ │ ├── HeroCentered.astro
│ │ │ └── HeroSideImage.astro
│ │ └── Footer/
│ │ └── Footer.astro
│ ├── config/
│ │ ├── faqData.json.ts
│ │ └── navData.json.ts
│ ├── content/
│ │ ├── authors/
│ │ ├── blog/
│ │ ├── otherPages/
│ │ └── config.ts
│ ├── js/
│ │ └── blogUtils.ts
│ ├── layouts/
│ │ └── BaseLayout.astro
│ ├── pages/
│ │ ├── index.astro
│ │ ├── blog/
│ │ │ ├── [...slug].astro
│ │ │ └── index.astro
│ │ ├── categories/
│ │ │ ├── [category].astro
│ │ │ └── index.astro
│ │ ├── [page].astro
│ │ ├── 404.astro
│ │ ├── contact.astro
│ │ ├── index.astro
│ │ └── rss.xml.ts
│ └── styles/
│ └── global.scss
├── .gitignore
├── .prettierrc.mjs
├── astro.config.mjs
├── netlify.toml
├── package.json
├── package-lock.json
├── README.md
├── tailwind.config.cjs
└── tsconfig.json
For robots like Google to see the correct sitemap, you will want to edit the public/robots.txt file to use your website domain.
- See my blog post on recommended Astro web development setup.
- You can learn more information from the theme docs page on the Cosmic Themes Website.
- For support, see the support page.
- License details
Astro looks for .astro or .md files in the src/pages/ directory. Each page is exposed as a route based on its file name.
There's nothing special about src/components/, but that's where we like to put any Astro/React/Vue/Svelte/Preact components.
Any static assets, like images, can be placed in the public/ directory. I also frequently use src/assets for images when using Astro asssets for image optimization.
All commands are run from the root of the project, from a terminal:
| Command | Action |
|---|---|
npm install |
Installs dependencies |
npm run dev |
Starts local dev server at localhost:3000 |
npm run build |
Build your production site to ./dist/ |
npm run preview |
Preview your build locally, before deploying |
npm run astro ... |
Run CLI commands like astro add, astro check |
npm run astro -- --help |
Get help using the Astro CLI |
Feel free to check out the Astro documentation.