Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
dantrevino committed Oct 3, 2024
1 parent 021d6d7 commit 57c5027
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 300 deletions.
162 changes: 8 additions & 154 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
# Astro Starter Kit: Docs Site
# Boom Platform: Docs Site

[![Build Astro site](https://github.com/advanced-astro/astro-docs-template/actions/workflows/test.yml/badge.svg)](https://github.com/advanced-astro/astro-docs-template/actions/workflows/test.yml)

```bash
pnpm create astro@latest -- --template advanced-astro/astro-docs-template
```

[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/advanced-astro/astro-docs-template)
[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/s/github/advanced-astro/astro-docs-template)

> 🧑‍🚀 **Seasoned astronaut?** Delete this file. Have fun!
docs are found in the `src/content/docs/<lang>` folder(s). Pages are written in markdown or mdx.

![docs](https://user-images.githubusercontent.com/4677417/186189283-0831b9ab-d6b9-485d-8955-3057e532ab31.png)

## Key Features

- 📝 **Full Markdown and MDX support**
- 📱 **Responsive mobile-friendly design**
- 🧭 **Sidebar navigation**
- 🔎 **Search (powered by Algolia)**
- 🔤 **Self-Hosted webfont (GDPR compliant)**
- 🗨️ **Multi-language i18n**
- 📃 **Automatic table of contents**
- 🧑‍💻 **Automatic list of contributors**
- 🌙 (and, best of all) **dark mode**

## 🧞 Commands

Expand All @@ -38,141 +16,17 @@ All commands are run from the root of the project, from a terminal:
| `pnpm run astro ...` | Run CLI commands like `astro add`, `astro check` |
| `pnpm run astro --help` | Get help using the Astro CLI |

To deploy your site to production, check out our [Deploy an Astro Website](https://docs.astro.build/guides/deploy) guide.

## 👀 Want to learn more?

Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).

## Customize This Theme

### Site metadata

`src/config.ts` contains several data objects that describe metadata about your site like title, description, default language, and Open Graph details. You can customize these to match your project.

### SCSS styling

The theme's look and feel is controlled by a few key variables that you can customize yourself. You'll find them in the `src/styles/theme.scss` SCSS file.

If you've never worked with CSS variables before, give [MDN's guide on CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) a quick read.

This theme uses a "cool blue" accent color by default. To customize this for your project, change the `--theme-accent` variable to whatever color you'd like:

```diff
/* src/styles/theme.css */
:root {
color-scheme: light;
- --theme-accent: hsla(var(--color-blue), 1);
+ --theme-accent: hsla(var(--color-red), 1); /* or: hsla(#FF0000, 1); */
```

## Page metadata

Astro uses frontmatter in [Markdown](https://www.markdownguide.org/) and [MDX](https://mdxjs.com/) pages to choose layouts and pass properties to those layouts. If you are using the default layout, you can customize the page in many different ways to optimize SEO and other things. For example, you can use the `title` and `description` properties to set the document title, meta title, meta description, and Open Graph description.

```markdown
---
title: Example title
description: Really cool docs example that uses Astro
layout: ../../layouts/MainLayout.astro
---

# Page content...
```

For more SEO related properties, look at `src/components/HeadSEO.astro`

### Sidebar navigation

The sidebar navigation is controlled by the `SIDEBAR` variable in your `src/config.ts` file. You can customize the sidebar by modifying this object. A default, starter navigation has already been created for you.

```ts
export const SIDEBAR = {
en: [
{ text: 'Section Header', header: true },
{ text: 'Introduction', link: 'en/introduction' },
{ text: 'Page 2', link: 'en/page-2' },
{ text: 'Page 3', link: 'en/page-3' },
## New to Astro?

{ text: 'Another Section', header: true },
{ text: 'Page 4', link: 'en/page-4' }
]
}
```

Note the top-level `en` key: This is needed for multi-language support. You can change it to whatever language you'd like, or add new languages as you go. More details on this below.

### Multiple Languages support

The Astro docs template supports multiple languages out of the box. The default theme only shows `en` documentation, but you can enable multi-language support features by adding a second language to your project.

To add a new language to your project, you'll want to extend the current `src/content/docs/[lang]/...` layout:

```diff
📂 src/content/docs
┣ 📂 en
┃ ┣ 📜 page-1.md
┃ ┣ 📜 page-2.md
┃ ┣ 📜 page-3.astro
+ ┣ 📂 es
+ ┃ ┣ 📜 page-1.md
+ ┃ ┣ 📜 page-2.md
+ ┃ ┣ 📜 page-3.astro
```

You'll also need to add the new language name to the `KNOWN_LANGUAGES` map in your `src/config.ts` file. This will enable your new language switcher in the site header.

```diff
// src/config.ts
export const KNOWN_LANGUAGES = {
English: 'en',
+ Spanish: 'es',
};
```

Last step: you'll need to add a new entry to your sidebar, to create the table of contents for that language. While duplicating every page might not sound ideal to everyone, this extra control allows you to create entirely custom content for every language.

> Make sure the sidebar `link` value points to the correct language!
```diff
// src/config.ts
export const SIDEBAR = {
en: [
{ text: 'Section Header', header: true, },
{ text: 'Introduction', link: 'en/introduction' },
// ...
],
+ es: [
+ { text: 'Encabezado de sección', header: true, },
+ { text: 'Introducción', link: 'es/introduction' },
+ // ...
+ ],
};

// ...
```

If you plan to use Spanish as the default language, you just need to modify the redirect path in `src/pages/index.astro`:
[![Build Astro site](https://github.com/advanced-astro/astro-docs-template/actions/workflows/test.yml/badge.svg)](https://github.com/advanced-astro/astro-docs-template/actions/workflows/test.yml)

```diff
<script>
- window.location.pathname = `/en/introduction`;
+ window.location.pathname = `/es/introduction`;
</script>
```bash
pnpm create astro@latest -- --template advanced-astro/astro-docs-template
```

You can also remove the above script and write a landing page in Spanish instead.

### What if I don't plan to support multiple languages?

That's totally fine! Not all projects need (or can support) multiple languages. You can continue to use this theme without ever adding a second language.

If that single language is not English, you can just replace `en` in directory layouts and configurations with the preferred language.

### Search (Powered by Algolia)

[Algolia](https://www.algolia.com/) offers a free service to qualified open source projects called [DocSearch](https://docsearch.algolia.com/). If you are accepted to the DocSearch program, provide your API Key & index name in `src/config.ts` and a search box will automatically appear in your site header.

Note that Aglolia and Astro are not affiliated. We have no say over acceptance to the DocSearch program.
## 👀 Want to learn more?

If you'd prefer to remove Algolia's search and replace it with your own, check out the `src/components/Header.astro` component to see where the component is added.
Feel free to check [our documentation](https://docs.astro.build) or jump into our [Discord server](https://astro.build/chat).
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ import sitemap from '@astrojs/sitemap'
export default defineConfig({
integrations: [mdx(), preact(), react(), sitemap()],
base: `/`,
site: `https://stackspay.org`
site: `https://boom.money`
})
4 changes: 2 additions & 2 deletions src/components/Footer/AvatarList.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ type Props = {
}
const { path } = Astro.props
const resolvedPath = `${path}`
const url = `https://api.github.com/repos/advanced-astro/astro-docs-template/commits?path=${resolvedPath}`
const commitsURL = `https://github.com/advanced-astro/astro-docs-template/commits/main/${resolvedPath}`
const url = `https://api.github.com/repos/boomcrypto/docs.boom.money/commits?path=${resolvedPath}`
const commitsURL = `https://github.com/boomcrypto/docs.boom.money/commits/main/${resolvedPath}`
type Commit = {
author: {
Expand Down
9 changes: 3 additions & 6 deletions src/components/HeadSEO.astro
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,7 @@ const imageAlt = image?.alt ?? OPEN_GRAPH.image.alt
<meta name="twitter:description" content={description ?? SITE.description} />
<meta name="twitter:image" content={canonicalImageSrc} />
<meta name="twitter:image:alt" content={imageAlt} />
<meta name="twitter:creator" content={OPEN_GRAPH.twitter} />
<meta name="twitter:url" content='https://boom.money' />

<!--
TODO: Add json+ld data, maybe https://schema.org/APIReference makes sense?
Docs: https://developers.google.com/search/docs/advanced/structured-data/intro-structured-data
https://www.npmjs.com/package/schema-dts seems like a great resource for implementing this.
Even better, there's a React component that integrates with `schema-dts`: https://github.com/google/react-schemaorg
-->

8 changes: 4 additions & 4 deletions src/components/Header/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import BoomLogo from './BoomLogo.astro'
import SkipToContent from './SkipToContent.astro'
import SidebarToggle from './SidebarToggle'
import LanguageSelect from './LanguageSelect'
import Search from './Search'
// import Search from './Search'
type Props = {
currentPage: string
Expand All @@ -28,14 +28,14 @@ const lang = getLanguageFromURL(currentPage)
</a>
</div>
<!-- <div style="flex-grow: 1;"></div> -->
<div class="search-item">
<!-- <div class="search-item">
<Search client:idle />
</div>
</div> -->
{
KNOWN_LANGUAGE_CODES.length > 1 && (
<LanguageSelect lang={lang} client:idle />
)
}
}
</nav>
</header>

Expand Down
7 changes: 3 additions & 4 deletions src/consts.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
export const SITE = {
title: 'Boom',
description: 'Boom: Fast and easy Bitcoin payments',
description: 'Fast and easy Bitcoin payments',
defaultLanguage: 'en-us'
} as const

export const OPEN_GRAPH = {
image: {
src: 'default-og-image.png',
alt:
'Boom logo,'
alt: 'Boom. Fast & easy Bitcoin payments.'
},
twitter: 'boom_wallet'
twitter: 'boom_wallet',
}

export const KNOWN_LANGUAGES = {
Expand Down
2 changes: 1 addition & 1 deletion src/content/docs/en/introduction.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Introduction
hide_breadcrumbs: true
hide_breadcrumbs: true
---

**Boom** is built to leverage the Stacks blockchain & sBTC make a more decentralized, non-custodial, trust minimized Bitcoin payment layer for the rest of us.
Expand Down
128 changes: 0 additions & 128 deletions src/content/docs/en/merchant.mdx

This file was deleted.

0 comments on commit 57c5027

Please sign in to comment.