mirror of
https://github.com/withastro/astro.git
synced 2025-03-24 23:21:57 -05:00
[docs] test config-reference formatting for sidebar (#9052)
Co-authored-by: Chris Swithinbank <357379+delucis@users.noreply.github.com> Co-authored-by: Emanuele Stoppa <602478+ematipico@users.noreply.github.com> Co-authored-by: Elian <15145918+ElianCodes@users.noreply.github.com>
This commit is contained in:
parent
13ca6d989b
commit
aa4ef8a1e7
1 changed files with 71 additions and 66 deletions
|
@ -536,71 +536,6 @@ export interface AstroUserConfig {
|
|||
*/
|
||||
redirects?: Record<string, RedirectConfig>;
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @name prefetch
|
||||
* @type {boolean | object}
|
||||
* @description
|
||||
* Enable prefetching for links on your site to provide faster page transitions.
|
||||
* (Enabled by default on pages using the `<ViewTransitions />` router. Set `prefetch: false` to opt out of this behaviour.)
|
||||
*
|
||||
* This configuration automatically adds a prefetch script to every page in the project
|
||||
* giving you access to the `data-astro-prefetch` attribute.
|
||||
* Add this attribute to any `<a />` link on your page to enable prefetching for that page.
|
||||
*
|
||||
* ```html
|
||||
* <a href="/about" data-astro-prefetch>About</a>
|
||||
* ```
|
||||
* Further customize the default prefetching behavior using the [`prefetch.defaultStrategy`](#prefetchdefaultstrategy) and [`prefetch.prefetchAll`](#prefetchprefetchall) options.
|
||||
*
|
||||
* See the [Prefetch guide](https://docs.astro.build/en/guides/prefetch/) for more information.
|
||||
*/
|
||||
prefetch?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* @docs
|
||||
* @name prefetch.prefetchAll
|
||||
* @type {boolean}
|
||||
* @description
|
||||
* Enable prefetching for all links, including those without the `data-astro-prefetch` attribute.
|
||||
* This value defaults to `true` when using the `<ViewTransitions />` router. Otherwise, the default value is `false`.
|
||||
*
|
||||
* ```js
|
||||
* prefetch: {
|
||||
* prefetchAll: true
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When set to `true`, you can disable prefetching individually by setting `data-astro-prefetch="false"` on any individual links.
|
||||
*
|
||||
* ```html
|
||||
* <a href="/about" data-astro-prefetch="false">About</a>
|
||||
*```
|
||||
*/
|
||||
prefetchAll?: boolean;
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @name prefetch.defaultStrategy
|
||||
* @type {'tap' | 'hover' | 'viewport'}
|
||||
* @default `'hover'`
|
||||
* @description
|
||||
* The default prefetch strategy to use when the `data-astro-prefetch` attribute is set on a link with no value.
|
||||
*
|
||||
* - `'tap'`: Prefetch just before you click on the link.
|
||||
* - `'hover'`: Prefetch when you hover over or focus on the link. (default)
|
||||
* - `'viewport'`: Prefetch as the links enter the viewport.
|
||||
*
|
||||
* You can override this default value and select a different strategy for any individual link by setting a value on the attribute.
|
||||
*
|
||||
* ```html
|
||||
* <a href="/about" data-astro-prefetch="viewport">About</a>
|
||||
* ```
|
||||
*/
|
||||
defaultStrategy?: 'tap' | 'hover' | 'viewport';
|
||||
};
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @name site
|
||||
|
@ -979,6 +914,72 @@ export interface AstroUserConfig {
|
|||
excludeMiddleware?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @kind heading
|
||||
* @name Prefetch Options
|
||||
* @type {boolean | object}
|
||||
* @description
|
||||
* Enable prefetching for links on your site to provide faster page transitions.
|
||||
* (Enabled by default on pages using the `<ViewTransitions />` router. Set `prefetch: false` to opt out of this behaviour.)
|
||||
*
|
||||
* This configuration automatically adds a prefetch script to every page in the project
|
||||
* giving you access to the `data-astro-prefetch` attribute.
|
||||
* Add this attribute to any `<a />` link on your page to enable prefetching for that page.
|
||||
*
|
||||
* ```html
|
||||
* <a href="/about" data-astro-prefetch>About</a>
|
||||
* ```
|
||||
* Further customize the default prefetching behavior using the [`prefetch.defaultStrategy`](#prefetchdefaultstrategy) and [`prefetch.prefetchAll`](#prefetchprefetchall) options.
|
||||
*
|
||||
* See the [Prefetch guide](https://docs.astro.build/en/guides/prefetch/) for more information.
|
||||
*/
|
||||
prefetch?:
|
||||
| boolean
|
||||
| {
|
||||
/**
|
||||
* @docs
|
||||
* @name prefetch.prefetchAll
|
||||
* @type {boolean}
|
||||
* @description
|
||||
* Enable prefetching for all links, including those without the `data-astro-prefetch` attribute.
|
||||
* This value defaults to `true` when using the `<ViewTransitions />` router. Otherwise, the default value is `false`.
|
||||
*
|
||||
* ```js
|
||||
* prefetch: {
|
||||
* prefetchAll: true
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When set to `true`, you can disable prefetching individually by setting `data-astro-prefetch="false"` on any individual links.
|
||||
*
|
||||
* ```html
|
||||
* <a href="/about" data-astro-prefetch="false">About</a>
|
||||
*```
|
||||
*/
|
||||
prefetchAll?: boolean;
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @name prefetch.defaultStrategy
|
||||
* @type {'tap' | 'hover' | 'viewport'}
|
||||
* @default `'hover'`
|
||||
* @description
|
||||
* The default prefetch strategy to use when the `data-astro-prefetch` attribute is set on a link with no value.
|
||||
*
|
||||
* - `'tap'`: Prefetch just before you click on the link.
|
||||
* - `'hover'`: Prefetch when you hover over or focus on the link. (default)
|
||||
* - `'viewport'`: Prefetch as the links enter the viewport.
|
||||
*
|
||||
* You can override this default value and select a different strategy for any individual link by setting a value on the attribute.
|
||||
*
|
||||
* ```html
|
||||
* <a href="/about" data-astro-prefetch="viewport">About</a>
|
||||
* ```
|
||||
*/
|
||||
defaultStrategy?: 'tap' | 'hover' | 'viewport';
|
||||
};
|
||||
|
||||
/**
|
||||
* @docs
|
||||
* @kind heading
|
||||
|
@ -1456,6 +1457,7 @@ export interface AstroUserConfig {
|
|||
i18n?: {
|
||||
/**
|
||||
* @docs
|
||||
* @kind h4
|
||||
* @name experimental.i18n.defaultLocale
|
||||
* @type {string}
|
||||
* @version 3.5.0
|
||||
|
@ -1468,6 +1470,7 @@ export interface AstroUserConfig {
|
|||
defaultLocale: string;
|
||||
/**
|
||||
* @docs
|
||||
* @kind h4
|
||||
* @name experimental.i18n.locales
|
||||
* @type {string[]}
|
||||
* @version 3.5.0
|
||||
|
@ -1481,6 +1484,7 @@ export interface AstroUserConfig {
|
|||
|
||||
/**
|
||||
* @docs
|
||||
* @kind h4
|
||||
* @name experimental.i18n.fallback
|
||||
* @type {Record<string, string>}
|
||||
* @version 3.5.0
|
||||
|
@ -1490,7 +1494,7 @@ export interface AstroUserConfig {
|
|||
*
|
||||
* Use this object to declare a fallback `locale` route for each language you support. If no fallback is specified, then unavailable pages will return a 404.
|
||||
*
|
||||
* #### Example
|
||||
* ##### Example
|
||||
*
|
||||
* The following example configures your content fallback strategy to redirect unavailable pages in `/pt-br/` to their `es` version, and unavailable pages in `/fr/` to their `en` version. Unavailable `/es/` pages will return a 404.
|
||||
*
|
||||
|
@ -1513,6 +1517,7 @@ export interface AstroUserConfig {
|
|||
|
||||
/**
|
||||
* @docs
|
||||
* @kind h4
|
||||
* @name experimental.i18n.routingStrategy
|
||||
* @type {'prefix-always' | 'prefix-other-locales'}
|
||||
* @default 'prefix-other-locales'
|
||||
|
|
Loading…
Add table
Reference in a new issue