mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-22 18:24:21 +01:00
docs: handle base path
This commit is contained in:
@@ -43,7 +43,7 @@ export default defineConfig({
|
|||||||
tag: "link",
|
tag: "link",
|
||||||
attrs: {
|
attrs: {
|
||||||
rel: "icon",
|
rel: "icon",
|
||||||
href: "/favicon.svg",
|
href: "/docs/favicon.svg",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import type { Props } from '@astrojs/starlight/props'
|
|||||||
import Default from '@astrojs/starlight/components/Head.astro'
|
import Default from '@astrojs/starlight/components/Head.astro'
|
||||||
import config from '../../config.mjs'
|
import config from '../../config.mjs'
|
||||||
|
|
||||||
|
const base = import.meta.env.BASE_URL.slice(1)
|
||||||
|
|
||||||
const slug = Astro.url.pathname.replace(/^\//, "").replace(/\/$/, "");
|
const slug = Astro.url.pathname.replace(/^\//, "").replace(/\/$/, "");
|
||||||
const {
|
const {
|
||||||
entry: {
|
entry: {
|
||||||
@@ -42,7 +44,7 @@ if (isDocs) {
|
|||||||
|
|
||||||
<Default {...Astro.props}><slot /></Default>
|
<Default {...Astro.props}><slot /></Default>
|
||||||
|
|
||||||
{ (isDocs || !slug.startsWith("s")) && (
|
{ (!slug.startsWith(`${base}/s`)) && (
|
||||||
<meta property="og:image" content={ogImage} />
|
<meta property="og:image" content={ogImage} />
|
||||||
<meta property="twitter:image" content={ogImage} />
|
<meta property="twitter:image" content={ogImage} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user