From d0d7ccdd50f7722b3dfe870665140f3b11322aae Mon Sep 17 00:00:00 2001 From: Farnabaz Date: Tue, 18 Oct 2022 18:09:26 +0200 Subject: [PATCH] docs: update `findSurround` usage (#1609) --- docs/content/4.api/2.composables/1.query-content.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/content/4.api/2.composables/1.query-content.md b/docs/content/4.api/2.composables/1.query-content.md index f11bb9a98..49295e2d2 100644 --- a/docs/content/4.api/2.composables/1.query-content.md +++ b/docs/content/4.api/2.composables/1.query-content.md @@ -168,22 +168,23 @@ const firstArticle = await queryContent('articles').findOne() - Type: `{ before: number, after: number }`{lang=ts} - Default: `{ before: 1, after: 1 }`{lang=ts} -Get previous and next results around a specific path. +Get previous and next results around the path. The path should be full path of the target content. You will always obtain an array of fixed length filled with the matching document or null. ```ts -const [prev, next] = await queryContent('articles') +const [prev, next] = await queryContent() .only(['_path', 'title']) .sort({ date: 1}) .where({ isArchived: false }) - .findSurround('article-2') + .findSurround('/articles/article-2') // Returns [ { title: 'Article 1', - path: 'article-1' + _path: '/articles/article-1' + //... }, null // no article-3 here ]