diff --git a/src/content/docs/en/guides/content-collections.mdx b/src/content/docs/en/guides/content-collections.mdx index d85093421e967..2d13a4875668e 100644 --- a/src/content/docs/en/guides/content-collections.mdx +++ b/src/content/docs/en/guides/content-collections.mdx @@ -90,7 +90,7 @@ Astro provides [two built-in loader functions](/en/reference/content-loader-refe The [`glob()` loader](/en/reference/content-loader-reference/#glob-loader) creates entries from directories of Markdown, MDX, Markdoc, JSON, YAML, or TOML files from anywhere on the filesystem. It accepts a `pattern` of entry files to match using glob patterns supported by [micromatch](https://github.com/micromatch/micromatch#matching-features), and a base file path of where your files are located. Each entry's `id` will be automatically generated from its file name. Use this loader when you have one file per entry. -The [`file()` loader](/en/reference/content-loader-reference/#file-loader) creates multiple entries from a single local file. Each entry in the file must have a unique `id` key property. It accepts a `base` file path to your file and optionally a [`parser` function](#parser-function) for data files it cannot parse automatically. Use this loader when your data file can be parsed as an array of objects. +The [`file()` loader](/en/reference/content-loader-reference/#file-loader) creates multiple entries from a single local file. Each entry in the file must have a unique `id` key property. It accepts a `base` file path to your file and optionally a [`parser` function](#parser-function) for data files it cannot parse automatically, or to parse data asynchronously. Use this loader when your data file can be parsed as an array of objects. ```ts title="src/content.config.ts" {6,10} import { defineCollection } from 'astro:content'; diff --git a/src/content/docs/en/reference/api-reference.mdx b/src/content/docs/en/reference/api-reference.mdx index 8bcdbedcee4bb..56a79a84d67c1 100644 --- a/src/content/docs/en/reference/api-reference.mdx +++ b/src/content/docs/en/reference/api-reference.mdx @@ -829,6 +829,18 @@ Specifies a number, in seconds, for which the cookie is valid. Specifies a subpath of the domain in which the cookie is applied. +##### `partitioned` + +

+ +**Type:** `boolean`
+ +

+ +If true, the cookie is a [partitioned cookie](https://developer.mozilla.org/en-US/docs/Web/Privacy/Guides/Privacy_sandbox/Partitioned_cookies). Partitioned cookies can only be read within the context of the top-level site on which they were set, which allows cross-site tracking to be blocked while still enabling legitimate uses of third-party cookies. + +Partitioned cookies must be set with `secure: true`. + ##### `sameSite`

diff --git a/src/content/docs/en/reference/configuration-reference.mdx b/src/content/docs/en/reference/configuration-reference.mdx index 4e30098a4ecb4..ef3a39fd99079 100644 --- a/src/content/docs/en/reference/configuration-reference.mdx +++ b/src/content/docs/en/reference/configuration-reference.mdx @@ -978,6 +978,19 @@ Whether to enable the Astro Dev Toolbar. This toolbar allows you to inspect your This option is scoped to the entire project, to only disable the toolbar for yourself, run `npm run astro preferences disable devToolbar`. To disable the toolbar for all your Astro projects, run `npm run astro preferences disable devToolbar --global`. +### devToolbar.placement + +

+ +**Type:** `'bottom-left' | 'bottom-center' | 'bottom-right'`
+**Default:** `'bottom-center'`
+ +

+ +The default placement of the Astro Dev Toolbar on the screen. + +The placement of the toolbar can still be changed via the toolbar settings UI. Once changed, the user's preference is saved in `localStorage` and overrides this configuration value. + ## Prefetch Options

@@ -1110,6 +1123,19 @@ Whether or not to limit the size of images that the Sharp image service will pro Set `false` to bypass the default image size limit for the Sharp image service and process large images. +#### image.service.config.kernel + +

+ +**Type:** `string | undefined`
+**Default:** `undefined`
+ +

+ +The default [kernel used for resizing images](https://sharp.pixelplumbing.com/api-resize/#resize) in the Sharp image service. + +By default this is `undefined`, which maps to Sharp's default kernel of `lanczos3`. + ### image.domains

diff --git a/src/content/docs/en/reference/content-loader-reference.mdx b/src/content/docs/en/reference/content-loader-reference.mdx index ac5bbb40a78b4..062de7de6dec6 100644 --- a/src/content/docs/en/reference/content-loader-reference.mdx +++ b/src/content/docs/en/reference/content-loader-reference.mdx @@ -28,9 +28,9 @@ Astro provides two built-in loaders to help you fetch your collections. Both off The `glob()` loader creates entries from directories of files from anywhere on the filesystem. The supported file types are Markdown, MDX, Markdoc, JSON, YAML, and TOML files. -This loader accepts an object with the following properties: `pattern`, `base` (optional), and `generateId` (optional). +This loader accepts an object with the following properties: `pattern`, `base` (optional), `generateId` (optional), and `retainBody` (optional). -```ts title="src/content.config.ts" {2,6,11,17-21} +```ts title="src/content.config.ts" {2,6,11,17-21, 27-31} import { defineCollection } from 'astro:content'; import { glob } from 'astro/loaders'; @@ -44,6 +44,16 @@ const blog = defineCollection({ loader: glob({ pattern: "**/*.(md|mdx)", base: "./src/data/blog" }), schema: /* ... */ }); +const notes = defineCollection({ + /* Retrieve all Markdown files in your notes directory and prevent + * the raw body of content files from being stored in the data store. */ + loader: glob({ + pattern: '**/*.md', + base: './src/data/notes', + retainBody: false + }), + schema: /* ... */ +}); const authors = defineCollection({ /* Retrieve all JSON files in your authors directory while retaining * uppercase letters in the ID. */ @@ -91,6 +101,25 @@ A callback function that returns a unique string per entry in a collection. It a By default it uses [`github-slugger`](https://github.com/Flet/github-slugger) to generate a slug with [kebab-cased](https://developer.mozilla.org/en-US/docs/Glossary/Kebab_case) words. +#### `retainBody` + +

+ +**Type:** `boolean`
+**Default:** `true` + +

+ +Whether or not to store the raw body of content files in the data store. + +When `retainBody` is `false`, [`entry.body`](/en/reference/modules/astro-content/#body) will be `undefined` instead of containing the raw file contents. + +Setting this property to `false` significantly reduces the deployed size of the data store and helps avoid hitting size limits for sites with very large collections. + +For Markdown files, the rendered body will still be available in the [`entry.rendered.html` property](/en/reference/content-loader-reference/#rendered), and the [`entry.filePath` property](/en/reference/content-loader-reference/#filepath) will still point to the original file. + +For MDX collections, this will dramatically reduce the size of the collection, as there will no longer be any body retained in the store. + ### `file()` loader

@@ -143,7 +172,7 @@ An optional object with the following properties:

-**Type:** `(text: string) => Record> | Array>` +**Type:** `(text: string) => Record> | Array> | Promise> | Array>>`

A callback function to create a collection from a file’s contents. Use it when you need to process file not supported by default (e.g. `.csv`) or when using [nested `.json` documents](/en/guides/content-collections/#nested-json-documents). diff --git a/src/content/docs/en/reference/modules/astro-assets.mdx b/src/content/docs/en/reference/modules/astro-assets.mdx index c7176b70b1de5..adc261b0e6aa3 100644 --- a/src/content/docs/en/reference/modules/astro-assets.mdx +++ b/src/content/docs/en/reference/modules/astro-assets.mdx @@ -324,6 +324,33 @@ fetchpriority="high" These individual attributes can still be set manually if you need to customize them further. +#### `background` + +

+ +**Type:** `string | undefined`
+ +

+ +The background color to use when flattening an image to transform it into the requested output `format`. + +By default, Sharp uses a black background when flattening an image. Specifying a different background color is especially useful when transforming images with transparent backgrounds to a format that does not support transparency (e.g. `.jpeg`): + +```astro title="src/components/MyComponent.astro" "background" +--- +import { Image } from 'astro:assets'; +import myImage from '../assets/my_image.png'; +--- +A description of my image +``` + +Values are passed directly to the image service. Sharp accepts [any value the `color-string` package can parse](https://github.com/Qix-/color-string/blob/master/README.md#parsing). + ### ``

diff --git a/src/content/docs/en/reference/modules/astro-content.mdx b/src/content/docs/en/reference/modules/astro-content.mdx index 42b6fa66f62d5..a8eb579f635fd 100644 --- a/src/content/docs/en/reference/modules/astro-content.mdx +++ b/src/content/docs/en/reference/modules/astro-content.mdx @@ -274,10 +274,12 @@ An object of frontmatter properties inferred from your collection schema ([see ` #### `body` -**Type:** `string` +**Type:** `string | undefined` A string containing the raw, uncompiled body of the Markdown or MDX document. +Note that if [`retainBody`](/en/reference/content-loader-reference/#retainbody) is set to `false`, this value will be `undefined` instead of containing the raw file contents. + ### `CollectionKey`