Skip to content

Commit 2e701d9

Browse files
authored
Improve clairty in the Nextra v4 post (#1827)
1 parent baaf0fe commit 2e701d9

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

website/pages/blog/nextra-4/index.mdx

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ image: https://nextra.site/og?title=Nextra%204%0AApp%20Router%20/%20Turbopack
99
tags: [react, nextjs, nextra, react-compiler, rsc, app-router, turbopack, pagefind, i18n]
1010
---
1111

12-
import { Button, FileTree, Steps } from 'nextra/components'
12+
import { Button, FileTree, Steps, Tabs } from 'nextra/components'
1313
import BlogV3BundleSize from 'public/blog-assets/nextra-4/blog-v3-bundle-size.mdx'
1414
import BlogV4BundleSize from 'public/blog-assets/nextra-4/blog-v4-bundle-size.mdx'
1515
import DocsV3BundleSize from 'public/blog-assets/nextra-4/docs-v3-bundle-size.mdx'
@@ -267,13 +267,13 @@ Previously theme config options now should be passed as `props` for `<Layout>`,
267267

268268
## New Search Engine – Pagefind
269269

270-
Search engine was migrated from [FlexSearch](https://github.com/nextapps-de/flexsearch) written in
271-
JavaScript to Rust-powered [Pagefind](https://pagefind.app).
270+
The search engine has been migrated from [FlexSearch](https://github.com/nextapps-de/flexsearch),
271+
which is written in JavaScript to the Rust-powered [Pagefind](https://pagefind.app).
272272

273273
### Benefits
274274

275275
Pagefind is **significantly** faster and delivers **far superior** search results compared to
276-
FlexSearch. Here are some examples that previously didn't work in earlier versions of Nextra:
276+
FlexSearch. Here are some examples that didnt work in earlier versions of Nextra:
277277

278278
1. Indexing remote MDX.
279279

@@ -365,23 +365,30 @@ FlexSearch. Here are some examples that previously didn't work in earlier versio
365365
New search engine requires few steps to setup:
366366

367367
<Steps>
368-
<h4>Instal `pagefind` as `devDependency`</h4>
368+
<h4>Install `pagefind` as a dev dependency</h4>
369369
```sh npm2yarn
370370
npm i -D pagefind
371371
```
372-
<h4>Add `postbuild` script</h4>
372+
<h4>Add a `postbuild` script</h4>
373373

374374
Pagefind indexes `.html` pages and search indexing should be done after building your application:
375375

376-
```json filename="package.json" {4}
376+
<Tabs items={['Server builds', 'Static exports']}>
377+
<Tabs.Tab>
378+
```json filename="package.json" {2}
379+
"scripts": {
380+
"postbuild": "pagefind --site .next/server/app --output-path public/_pagefind"
381+
}
382+
```
383+
</Tabs.Tab>
384+
<Tabs.Tab>
385+
```json filename="package.json" {2}
377386
"scripts": {
378-
"dev": "next --turbopack",
379-
"build": "next build",
380-
"postbuild": "pagefind --site .next/server/app --output-path public/_pagefind",
381-
// Or if you use Next.js' Static Exports
382387
"postbuild": "pagefind --site .next/server/app --output-path out/_pagefind"
383388
}
384389
```
390+
</Tabs.Tab>
391+
</Tabs>
385392

386393
<h4>Enable `pre`/`post` scripts (_optional_)</h4>
387394

@@ -402,7 +409,7 @@ enable-pre-post-scripts=true
402409

403410
<h4>Add `_pagefind/` directory to `.gitignore` file</h4>
404411

405-
You don't need to commit `_pagefind/` directory to your git repository, he should be always newly
412+
You dont need to commit `_pagefind/` directory to your Git repository, as it is always newly
406413
generated.
407414

408415
```text filename=".gitignore" {3}
@@ -414,8 +421,8 @@ _pagefind/
414421
<h4>Use `<Search>` component in your custom theme</h4>
415422

416423
Search from `nextra-theme-docs` was exported in `nextra/components`. With this change
417-
`nextra-theme-blog` received search feature too. And you can benefit from it as well in your custom
418-
themes.
424+
`nextra-theme-blog` now also supports search. You can take advantage of this feature as well in your
425+
custom themes.
419426

420427
```jsx filename="app/layout.jsx" {1,8}
421428
import { Search } from 'nextra/components'
@@ -443,10 +450,8 @@ Thanks to server components, we no longer need to ship to client translation dic
443450
according translation as `props` to `<Layout>`, `<Banner>`, `<Footer>`, etc. components in
444451
`app/[lang]/layout.jsx`.
445452

446-
### Example
447-
448-
Below an example of server components i18n using `nextra-theme-docs`, but the same approach should
449-
be applied for your custom theme:
453+
Below is an example of server components i18n using `nextra-theme-docs`, but the same approach
454+
should be applied to your custom theme:
450455

451456
<ExampleLayoutForI18nDocsTheme />
452457

0 commit comments

Comments
 (0)