feat: add linkPrefetch
to config
This commit is contained in:
parent
d107ae7e10
commit
0393860169
2 changed files with 6 additions and 1 deletions
|
@ -28,6 +28,8 @@ export interface AstroConfig {
|
||||||
site?: string;
|
site?: string;
|
||||||
/** Generate sitemap (set to "false" to disable) */
|
/** Generate sitemap (set to "false" to disable) */
|
||||||
sitemap: boolean;
|
sitemap: boolean;
|
||||||
|
/** Automatically prefetch internal <a> links (set to "false" to disable) */
|
||||||
|
linkPrefetch?: boolean;
|
||||||
};
|
};
|
||||||
/** Options for the development server run with `astro dev`. */
|
/** Options for the development server run with `astro dev`. */
|
||||||
devOptions: {
|
devOptions: {
|
||||||
|
|
|
@ -13,7 +13,10 @@ export function getAttr(attributes: Attribute[], name: string): Attribute | unde
|
||||||
export function getAttrValue(attributes: Attribute[], name: string): string | undefined {
|
export function getAttrValue(attributes: Attribute[], name: string): string | undefined {
|
||||||
const attr = getAttr(attributes, name);
|
const attr = getAttr(attributes, name);
|
||||||
if (attr) {
|
if (attr) {
|
||||||
return attr.value[0]?.data;
|
const child = attr.value[0];
|
||||||
|
if (!child) return;
|
||||||
|
if (child.type === 'Text') return child.data;
|
||||||
|
if (child.type === 'MustacheTag') return child.expression.codeChunks[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue