feat: add linkPrefetch to config

This commit is contained in:
Nate Moore 2021-05-14 10:36:21 -05:00
parent d107ae7e10
commit 0393860169
2 changed files with 6 additions and 1 deletions

View file

@ -28,6 +28,8 @@ export interface AstroConfig {
site?: string;
/** Generate sitemap (set to "false" to disable) */
sitemap: boolean;
/** Automatically prefetch internal <a> links (set to "false" to disable) */
linkPrefetch?: boolean;
};
/** Options for the development server run with `astro dev`. */
devOptions: {

View file

@ -13,7 +13,10 @@ export function getAttr(attributes: Attribute[], name: string): Attribute | unde
export function getAttrValue(attributes: Attribute[], name: string): string | undefined {
const attr = getAttr(attributes, name);
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];
}
}