[ci] yarn format
This commit is contained in:
parent
f67e8f5f55
commit
b7e579a9cb
2 changed files with 31 additions and 20 deletions
|
@ -95,7 +95,7 @@ const {item} = Astro.props;
|
|||
|
||||
You can also group items by page. In this example, we'll fetch data from the same Pokemon API. But instead of generating 150 pages, we'll just generate one page for every letter of the alphabet, creating an alphabetical index of Pokemon.
|
||||
|
||||
*Note: Looking for pagination? Collections have built-in support to make pagination easy. Be sure to check out the next example.*
|
||||
_Note: Looking for pagination? Collections have built-in support to make pagination easy. Be sure to check out the next example._
|
||||
|
||||
```jsx
|
||||
---
|
||||
|
@ -240,7 +240,9 @@ export async function createCollection() {
|
|||
return {
|
||||
paginate: true,
|
||||
route: '/posts/:page?',
|
||||
async props({paginate}) { /* Not shown: see examples above */ },
|
||||
async props({ paginate }) {
|
||||
/* Not shown: see examples above */
|
||||
},
|
||||
rss: {
|
||||
title: 'My RSS Feed',
|
||||
description: 'Description of the feed',
|
||||
|
@ -270,8 +272,14 @@ Astro will generate your RSS feed at the URL `/feed/[collection].xml`. For examp
|
|||
Even though Astro will create the RSS feed for you, you’ll still need to add `<link>` tags manually in your `<head>` HTML for feed readers and browsers to pick up:
|
||||
|
||||
```html
|
||||
<link rel="alternate" type="application/rss+xml" title="My RSS Feed" href="/feed/podcast.xml" />
|
||||
<link
|
||||
rel="alternate"
|
||||
type="application/rss+xml"
|
||||
title="My RSS Feed"
|
||||
href="/feed/podcast.xml"
|
||||
/>
|
||||
```
|
||||
|
||||
### 📚 Further Reading
|
||||
|
||||
- [Fetching data in Astro](/guides/data-fetching)
|
||||
|
|
|
@ -69,6 +69,7 @@ const data = Astro.fetchContent('../pages/post/*.md'); // returns an array of po
|
|||
A collection is any file in the `src/pages` directory that starts with a dollar sign (`$`) and includes an exported `createCollection` function in the component script.
|
||||
|
||||
Check out our [Astro Collections](/core-concepts/collections) guide for more information and examples.
|
||||
|
||||
### `createCollection()`
|
||||
|
||||
```jsx
|
||||
|
@ -100,10 +101,13 @@ The `paginate()` function that you use inside of `props()` has the following int
|
|||
|
||||
```ts
|
||||
/* the "paginate()" passed to props({paginate}) */
|
||||
type PaginateFunction = (data: any[], args?: {
|
||||
type PaginateFunction = (
|
||||
data: any[],
|
||||
args?: {
|
||||
/* pageSize: set the number of items to be shown on every page. Defaults to 10. */
|
||||
pageSize?: number
|
||||
}) => PaginatedCollectionResult;
|
||||
pageSize?: number;
|
||||
}
|
||||
) => PaginatedCollectionResult;
|
||||
|
||||
/* the paginated return value, aka the prop passed to every page in the collection. */
|
||||
interface PaginatedCollectionResult {
|
||||
|
@ -172,7 +176,6 @@ export interface CollectionRSS<T = any> {
|
|||
|
||||
📚 Learn more about RSS feed generation (and see an example) in our [Astro Collections guide.](/core-concepts/collections).
|
||||
|
||||
|
||||
## `import.meta`
|
||||
|
||||
> In this section we use `[dot]` to mean `.`. This is because of a bug in our build engine that is rewriting `import[dot]meta[dot]env` if we use `.` instead of `[dot]`.
|
||||
|
|
Loading…
Reference in a new issue