2.0.18 • Published 5 days ago

@orama/plugin-astro v2.0.18

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 days ago

Orama's Astro Plugin

Tests

This package is a (still experimental) Orama integration for Astro.

Usage

Configuring the Astro integration

// In `astro.config.mjs`
import orama from '@orama/plugin-astro'

// https://astro.build/config
export default defineConfig({
  integrations: [
    orama({
      // We can generate more than one DB, with different configurations
      mydb: {
        // Required. Only pages matching this path regex will be indexed
        pathMatcher: /blog\/[0-9]{4}\/[0-9]{2}\/[0-9]{2}\/.+$/,

        // Optional. 'english' by default
        language: 'spanish',

        // Optional. ['body'] by default. Use it to constraint what is used to
        // index a page.
        contentSelectors: ['h1', 'main']
      }
    })
  ]
})

When running the astro build command, a new DB file will be persisted in the dist/assets directory. For the particular case of this example, it will be saved in the file dist/assets/oramaDB_mydb.json.

Using generated DBs in your pages

To use the generated DBs in your pages, you can include a script in your <head> section, as the following one:

<head>
  <!-- Other stuff -->
  <script>
    // Astro will do the job of bundling everything for you
    import { getOramaDB, search } from "@orama/plugin-astro/client"

    // We load the DB that we generated at build time, this is an asynchronous
    // operation, so we must either await, or rely on `.then` calls.
    const db = await getOramaDB('mydb')

    // Now we can search inside our DB. Of course, feel free to use it in more
    // interesting ways.
    console.log('Search Results')
    console.log(search(db, { term: 'mySearchTerm' }))
  </script>
</head>

NOTE: For now, this plugin only supports readonly DBs. This might change in the future if there's demand for it.

2.0.18

5 days ago

2.0.17

11 days ago

2.0.16

26 days ago

2.0.15

1 month ago

2.0.14

1 month ago

2.0.13

1 month ago

2.0.12

2 months ago

2.0.11

2 months ago

2.0.10

2 months ago

2.0.9

2 months ago

2.0.8

3 months ago

2.0.7

3 months ago

2.0.6

3 months ago

2.0.5

3 months ago

2.0.4

3 months ago

2.0.3

3 months ago

2.0.2

4 months ago

2.0.1

4 months ago

2.0.0

4 months ago

2.0.0-beta.12

5 months ago

2.0.0-beta.11

5 months ago

2.0.0-beta.10

5 months ago

2.0.0-beta.9

5 months ago

2.0.0-beta.8

5 months ago

1.2.0

9 months ago

1.2.8

8 months ago

1.2.7

8 months ago

1.0.9

10 months ago

1.2.6

8 months ago

1.2.5

8 months ago

1.2.4

8 months ago

1.2.3

8 months ago

1.2.2

8 months ago

1.2.1

9 months ago

1.2.10

7 months ago

1.2.11

7 months ago

1.1.1

10 months ago

1.1.0

10 months ago

2.0.0-beta.7

6 months ago

2.0.0-beta.2

7 months ago

2.0.0-beta.1

7 months ago

2.0.0-beta.6

6 months ago

2.0.0-beta.5

6 months ago

2.0.0-beta.4

6 months ago

2.0.0-beta.3

7 months ago

1.2.9

7 months ago

1.0.10

10 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

12 months ago

1.0.0-beta.15

1 year ago

1.0.0-beta.16

1 year ago

1.0.0-beta.14

1 year ago

1.0.0-beta.13

1 year ago

1.0.0-beta.12

1 year ago

1.0.0-beta.11

1 year ago

1.0.0-beta.10

1 year ago

1.0.0-beta.9

1 year ago

1.0.0-beta.8

1 year ago

1.0.0-beta.7

1 year ago

1.0.0-beta.6

1 year ago

1.0.0-beta.5

1 year ago

1.0.0-beta.4

1 year ago

1.0.0-beta.3

1 year ago

1.0.0-beta.2

1 year ago

1.0.0-beta.1

1 year ago

1.0.0-beta.0

1 year ago