# Customization Guide ## Content Collections ### Stock Content The written content in the template's collections was AI generated. The images are Creative Commons licenced with a paint filter applied to them. The goal was to have disposable content that better demonstrates the form of the collections than "Lorem ipsum". In case you're unsure, review my [Terms of Use](https://astrogon.reednel.com/terms/) for the policy on the use and redistribution of this content. ### The Mechanics The idea of a **Content Collection** is one of Astro's most central features. A content collection is a structured way to store and retrieve content for your site. Each collection consists of one or multiple **Entries**, which, in this site, are stored in a Markdown (md, mdx) format. At the top of any of these entry files, you will find **frontmatter**. This is space designed to hold any metadata you want to add, such as an entry's publication date, author, or whatever you want. Adding an entry to a collection is as simple as creating a new file in the appropriate directory under `/src/content/`. For example, to add a new blog post on Bumble Bees, you would create a new file `/src/content/blog/bumble-bees.md`, and add all the necessary frontmatter. Then you can start plugging away in markdown. This is all very easy, and it's one of the best features of Astro. You can focus on writing content rather than worrying about the underlying code. Things get a little more complicated when you want to create a new collection (or update an existing one). Here's a brief overview of how to do that. For examples, look at one of the dozen ways each of these steps are already implemented in this template. 1. The frontmatter we discussed must be defined in `/src/content/config.ts`. This file contains the schema for each collection. 2. To follow best Typescript practices, you should add your new collection type in `/src/content/config.ts`. 3. Add a new directory under `/src/content/` for your collection. 4. Lay out the structure of your entry's page. This will may consist of an `EntryLayout.astro` and a `CollectionLayout.astro` in the `/src/components/[collection]/` directory. These components will define how each entry and the collection as a whole will be displayed. 5. Connect the new collection to the routing structure by adding a new page in `/src/pages/` that will handle the routing for your collection. This typically involves calling `getEntries()` or `getIndex()` from the collection's config in the page's script section to retrieve the entries that will be referenced on that page. For more context on how the content collections work, see the [/docs/project-structure.md](/docs/project-structure.md) page. ## Theme Colors By default, the pallet of this site is defined in just 7 color parameters (14 if you count their dark theme variants). | Name | CSS Label | Main Use | | -------------------- | ----------- | ----------------------------------------------- | | Text Primary | `txt-p` | header text | | Text Secondary | `txt-s` | body text | | Text Light | `txt-light` | indicate selected text | | Background Primary | `bg-p` | main background (unless background is an image) | | Background Secondary | `bg-s` | glass elements | | Background Tertiary | `bg-t` | glass elements intended to contrast with `bg-s` | | Border | `border` | border around glass elements | ### Relevant Areas `/tailwind.config.js`: ```js module.exports = { ... theme: { ... extend: { colors: { ``` Structural changes would be made among: - `/tailwind.config.js` - `/src/styles/*` - The inline tailwind classes in `/src/components/*` ## Fonts External Resources: - [Google Fonts](https://fonts.google.com/) - [Mozilla Docs](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family) - [Inter Font](https://rsms.me/inter/#) - [Manrope Font](https://www.gent.media/manrope) Generic font families that require no import: ```txt font-family: serif; font-family: sans-serif; font-family: monospace; font-family: cursive; font-family: fantasy; font-family: system-ui; // uses the operating system's default ``` ### Relevant Areas `/tailwind.config.js`: ```js module.exports = { ... theme: { ... extend: { fontSize: { ... }, fontFamily: { ... }, ``` #### `/src/styles/fonts.css` All unused fonts referneces should be removed from this file. Likewise, any new fonts should be added here. This acts as the link between the `theme.json` and the actual font file stored in `/public/fonts/`. #### `/public/fonts/` Put font files here. It is recommended to store here only the font files that are actually used in the site. The more font files there are, the slower the site will load. This template comes with a few moderate options to experiment with, but you should remove any that you don't end up using. A common alternative to this is to use a CDN to host the font files. This will work a little differently than shown here. Do not use a Google CDN, those dirty bastards can track your users that way. ## Background By default the background is a flat color defined by the `bg-p` color parameter discussed in the **Theme Colors** section. ### Relevant Areas #### `/src/base/Background.astro` Here I've provided three alternate kinds of background. All are commented out, but simply uncomment the desired one to use it. These are largely for demonstration purposes, and you should feel free to delete them and replace them with your own background. This file is referenced only in `/src/base/BaseLayout.astro`. #### `tailwind.config.js` The provided **Twinkling Star Background** and **Gradient Cycle Background** depend on animations defined in this file. ```js module.exports = { theme: { extend: { animation: { // Star Background twinkle: "twinkle 5s infinite ease-in-out", // Cycle Background cycleBg: "cycleBg 15s ease infinite" }, keyframes: { // Star Background twinkle: { "0%, 20%, 100%": { opacity: 1 }, "10%": { opacity: 0.25 }, }, // Cycle Background cycleBg: { "0%, 100%": { backgroundPosition: "0% 50%" }, "50%": { backgroundPosition: "100% 50%" }, }, }, } } ``` Additionally, there are code examples for single and dual-image backgrounds, depending on whether you want the background to change when the light/dark theme does. Swapping in your own images here is very straightforward. ### Parsimony If you decide to use a solid color background, you can of course delete the code mentioned in the **Relevant Areas** section above. ## Glass Effect One of the most powerful customization features of this template is the glass effect. By default, the template uses a true frosted glass effect, but by changing a few parameters specified below, the UI components can be given fully transparent or fully opaque backgrounds, for a more conventional website look. | Name | CSS Label | Main Use | | ------------------------- | -------------------- | ------------------------------------------------------- | | Glass | `glass` | styles the background of most components | | Glass Tertiary | `glass-t` | for glass atop other glass, resembles the use of `bg-t` | | Glass Tertiary Borderless | `glass-t-borderless` | ui componnents with their own border | Parameters: | Name | Explanation | | ------- | -------------------------------------------------------------------------------------------------------------------------------------- | | Color | The underlying background color of the element. | | Opacity | `0` is fully transparent and `1` is fully opaque. If a color is specified, the default opacity is `1`, and if not, it's transparent. | | Blur | The [blur](https://tailwindcss.com/docs/blur) is applied to the element's background, and the element itself is made semi-transparent. | | Border | The border around the element. By default this effect is subtle, but adds a nice touch to the glass effect. | | Shadow | The shadow around the element, giving it a bit of depth. | ### Relevant Areas #### `/src/styles/glass.css` ## Animations The animations are fairly subtle by default. ### Usage | Animation | CSS | | ---------- | -------------------------------------------- | | Fade | `intersect:animate-fade opacity-0` | | Fade Up | `intersect:animate-fadeUp opacity-0` | | Fade Down | `intersect:animate-fadeDown opacity-0` | | Fade Right | `intersect:animate-fadeRight opacity-0` | | Fade Left | `intersect:animate-fadeLeft opacity-0` | | Scale | `intersect:animate-scale opacity-0 scale-50` | | Animation Trigger | CSS | | ----------------------------- | -------------------- | | Element fully in view | `intersect-full` | | Element 50% in view | `intersect-half` | | Element 25% in view (default) | `intersect-quarter` | | Animate on every intersection | `intersect-repeat` | | Animate element immediately | `intersect-no-queue` | ### Relevant Areas `/tailwind.config.js`: ```js module.exports = { theme: { extend: { animation: { // ... }, keyframes: { // ... }, }, }, plugins: [ plugin(({ addVariant }) => { addVariant("intersect", "&:not([no-intersect])"); }), ], }; ``` `/src/components/base/ObserverScript.astro`: This is a segment of JS run as an inline `