feat: add customizable 'powered by' presets

This commit is contained in:
草师傅 2025-08-10 22:05:35 +08:00
parent 28baacbf0d
commit 457fb93718
Signed by: gb
GPG key ID: 43330A030E2D6478
2 changed files with 35 additions and 1 deletions

View file

@ -1,4 +1,34 @@
---
import Logo from '../assets/mercury.svg'
import AstroLogo from '../assets/astro.svg'
import {siteConfig} from "../config";
const presets = [
'withastro',
'plain',
'plainwithastro',
'formula',
'iconsonly',
'none'
]
const preset = siteConfig.poweredByPreset
---
<p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /> mercury</a></p>
{preset === 'withastro' && <p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /> mercury</a> and <AstroLogo width={16} height={16}/> Astro </p>}
{preset === 'plain' && <p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank">mercury</a></p>}
{preset === 'plainwithastro' && <p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /> mercury</a> and <AstroLogo width={16} height={16}/> Astro </p>}
{preset === 'formula' && <p><a href="https://astro.build">Astro</a> + <a href="https://git.gb0.dev/gb/mercury">mercury</a> + love -> this awesome website</p>}
{preset === 'iconsonly' &&
<p>
<a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /></a>
<a href="https://astro.build" target="_blank"><AstroLogo width={16} height={16}/></a>
</p>
}
{preset === 'none' && <p></p>}
{(!presets.includes(preset) || preset === '') && <p>Powered by <a href="https://git.gb0.dev/gb/mercury" target="_blank"><Logo width={16} height={16} /> mercury</a></p>}

View file

@ -93,6 +93,10 @@ export const siteConfig = {
// footer
// yes you can write html safely here
customFooter: '<i>I have no mouth, and I must SCREAM</i>',
// the preset of the powered by text
// defaults to 'Powered by Mercury', see PoweredBy.astro for more details
// choose from 'default', 'withastro', 'plain', 'plainwithastro', 'formula', 'iconsonly' and 'none', any other value will be treated as 'default'
poweredByPreset: '',
// umami analytics
// by enabling this, you can track the visitors of your site
siteAnalytics: {