diff --git a/.env.production b/.env.production new file mode 100644 index 0000000000..e97c0efc41 --- /dev/null +++ b/.env.production @@ -0,0 +1,5 @@ +# DO NOT add secrets here - this file is checked into git. +# Production defaults for the shared navbar/footer integration. +FOOTER_FRAGMENT_URL=https://octopus.com/fragments/footer +SHARED_ASSETS_BASE_URL=https://octopus.com/octopus-public/assets +SHARED_ASSETS_ORIGIN=https://octopus.com diff --git a/.env.staging b/.env.staging new file mode 100644 index 0000000000..2353580109 --- /dev/null +++ b/.env.staging @@ -0,0 +1,8 @@ +# DO NOT add secrets here - this file is checked into git. +# +# Defaults match production. Edit temporarily to point at staging URLs +# (e.g. https://a.dev.octopus.com/...) when you want to preview upcoming +# shared navbar/footer changes locally before they ship to prod. +FOOTER_FRAGMENT_URL=https://octopus.com/fragments/footer +SHARED_ASSETS_BASE_URL=https://octopus.com/octopus-public/assets +SHARED_ASSETS_ORIGIN=https://octopus.com diff --git a/.gitignore b/.gitignore index c27d0a06f8..6453bc0cb4 100644 --- a/.gitignore +++ b/.gitignore @@ -18,7 +18,6 @@ pnpm-debug.log* # environment variables .env -.env.production # macOS-specific files .DS_Store diff --git a/README.md b/README.md index fd74c06025..82fc6b55ff 100644 --- a/README.md +++ b/README.md @@ -227,6 +227,48 @@ Within an MDX file, this looks like a code block and will error. Escape the stat MDX files don't allow short-form links, instead of using `` use `[https://example.com](https://example.com)`, or even better - put in useful link text, like `[example website](https://example.com)`. +## Shared footer + +The footer is not maintained in this repo. It is fetched at build time from the +main site: + +- `https://octopus.com/fragments/footer` + +CSS, JS, and fonts load at page-view time from +`https://octopus.com/octopus-public/assets/...` via `` and +` diff --git a/src/env.d.ts b/src/env.d.ts index acef35f175..e843fe904a 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1,2 +1,11 @@ /// /// + +interface ImportMetaEnv { + readonly FOOTER_FRAGMENT_URL: string; + readonly SHARED_ASSETS_BASE_URL: string; + readonly SHARED_ASSETS_ORIGIN: string; +} +interface ImportMeta { + readonly env: ImportMetaEnv; +} diff --git a/src/fallback/footer.html b/src/fallback/footer.html new file mode 100644 index 0000000000..44861e67e4 --- /dev/null +++ b/src/fallback/footer.html @@ -0,0 +1,740 @@ + + + + diff --git a/src/layouts/Default.astro b/src/layouts/Default.astro index 0221ebdc55..8669d5df3e 100644 --- a/src/layouts/Default.astro +++ b/src/layouts/Default.astro @@ -15,7 +15,6 @@ import Taxonomy from '@components/Taxonomy.astro'; // Custom components import ArticleHeader from '../components/ArticleHeader.astro'; import ArticleNav from '../components/ArticleNav.astro'; -import Copyright from '../components/Copyright.astro'; import Header from '../components/Header.astro'; import Related from '../components/Related.astro'; import ArticleJourney from '../components/ArticleJourney.astro'; @@ -24,7 +23,8 @@ import EditOnGithub from '../components/EditOnGithub.astro'; import LastUpdated from '../components/LastUpdated.astro'; import CopyMarkdown from '../components/CopyMarkdown.astro'; import Plausible from 'src/components/Plausible.astro'; -import Footer from 'src/components/Footer.astro'; +import SharedFooter from 'src/components/SharedFooter.astro'; +import SharedScripts from 'src/components/SharedScripts.astro'; // Extend Frontmatter with icon type Frontmatter = OriginalFrontmatter & { @@ -137,7 +137,7 @@ const showSearch = !isSearchPage; -