diff --git a/README.md b/README.md index 1e366eb..7d59fd8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FXHU -Daily foreign exchange rates as published by the National Bank of Hungary (Magyar Nemzeti Bank, MNB). +Exchange rates API sourced from the National Bank of Hungary (Magyar Nemzeti Bank, MNB). ## Rate-setting methodology diff --git a/astro.config.ts b/astro.config.ts index 1ff8256..2941d9a 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -2,14 +2,25 @@ import starlight from "@astrojs/starlight"; import { defineConfig } from "astro/config"; import starlightOpenAPI, { openAPISidebarGroups } from "starlight-openapi"; +import { buildId } from "./src/utils/buildId"; +import { socialImageHeight, socialImageWidth } from "./src/utils/socialImage"; + export default defineConfig({ site: "https://fxhu.kripod.dev", + trailingSlash: + // TODO: Use 'always', see: https://github.com/withastro/astro/issues/10149 + import.meta.env.PROD ? "always" : "ignore", integrations: [ starlight({ title: "FXHU", + description: + "Exchange rates API sourced from the National Bank of Hungary (Magyar Nemzeti Bank, MNB).", social: { github: "https://github.com/kripod/fxhu", }, + editLink: { + baseUrl: "https://github.com/kripod/fxhu/edit/main/", + }, plugins: [ starlightOpenAPI([ { @@ -21,6 +32,44 @@ export default defineConfig({ ]), ], sidebar: [...openAPISidebarGroups], + head: [ + { + tag: "link", + attrs: { + rel: "icon", + href: "/favicon.ico", + sizes: "48x48", + }, + }, + { + tag: "meta", + attrs: { + property: "og:image", + content: "/assets/social-image.png?v=" + buildId, + }, + }, + { + tag: "meta", + attrs: { + property: "og:image:width", + content: socialImageWidth.toString(), + }, + }, + { + tag: "meta", + attrs: { + property: "og:image:height", + content: socialImageHeight.toString(), + }, + }, + { + tag: "meta", + attrs: { + name: "twitter:card", + content: "summary_large_image", + }, + }, + ], }), ], }); diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e82ba9f Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/assets/icons/icon.svg b/public/favicon.svg similarity index 100% rename from src/assets/icons/icon.svg rename to public/favicon.svg diff --git a/src/content/docs/index.mdx b/src/content/docs/index.mdx index b3010fc..8d82570 100644 --- a/src/content/docs/index.mdx +++ b/src/content/docs/index.mdx @@ -1,5 +1,22 @@ --- -title: TODO +title: FXHU +editUrl: false +head: + - tag: title + content: FXHU +template: splash +hero: + tagline: Exchange rates API sourced from the National Bank of Hungary (Magyar Nemzeti Bank, MNB). + image: + file: ../../../public/favicon.svg + actions: + - text: Get started + link: /docs/v1/ + variant: primary + icon: right-arrow + - text: View on GitHub + link: https://github.com/kripod/fxhu + icon: external + attrs: + rel: me --- - -TODO diff --git a/src/utils/buildId.ts b/src/utils/buildId.ts new file mode 100644 index 0000000..488aae0 --- /dev/null +++ b/src/utils/buildId.ts @@ -0,0 +1,3 @@ +export const buildId = import.meta.env.CF_PAGES_COMMIT_SHA + ? import.meta.env.CF_PAGES_COMMIT_SHA.slice(0, 7) + : Date.now().toString(); diff --git a/src/utils/socialImage.ts b/src/utils/socialImage.ts new file mode 100644 index 0000000..3fc178a --- /dev/null +++ b/src/utils/socialImage.ts @@ -0,0 +1,2 @@ +export const socialImageWidth = 1200; +export const socialImageHeight = 628;