ShoppingGuidesHeadlines
On this page
Algolia Shopping Guides is currently in beta according to the Algolia Terms of Service (“Beta Services”).
React
The <ShoppingGuidesHeadlines />
widget lets you reference and render different shopping guides on your website.
Installation
The Algolia Shopping Guides React package is available on the npm registry.
1
2
3
yarn add @algolia/generative-experiences-react
# or
npm install @algolia/generative-experiences-react
Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { createClient } from '@algolia/generative-experiences-api-client';
import {
ShoppingGuidesHeadlines,
} from '@algolia/generative-experiences-react';
const client = createClient({
appId: 'YourApplicationID',
indexName: 'your_index_name',
searchOnlyAPIKey: 'YourSearchOnlyAPIKey',
region: 'us',
});
function App({ userToken, category }) {
//...
return (
<ShoppingGuidesHeadlines
showFeedback
userToken={userToken}
nbHeadlines={6}
client={client}
category={category}
showImmediate
/>
)
}
Parameters
client
|
type: GSEClient
Required
The initialized Algolia Generative Experiences client. |
||
category
|
type: string
Required
The category used for retrieving the headlines. |
||
nbHeadlines
|
type: number
The number of headlines to display. Default: 4 |
||
onlyPublished
|
type: boolean
Whether to only return headlines with generated content. Default: |
||
showImmediate
|
type: boolean
Whether to generate and display the headlines on load. Default: |
||
showFeedback
|
type: boolean
Whether to show the feedback widget. Default: |
||
userToken
|
type: string
The user token needed for computing feedback. |
||
children
|
type: (props: ChildrenProps) => JSX.Element
A render function to fully customize what’s displayed. The default implementation is:
Copy
|
||
view
|
type: ViewProps
The view component into which your shopping guide headlines will be rendered. The default implementation is:
Copy
|
||
itemComponent
|
type: ({ item, createElement, Fragment, html }) => JSX.Element | VNode | VNode[]
Component to display the headlines. |
||
classNames
|
type: HeadlinesButtonClassNames
The class names for the component.
Copy
|
JavaScript
The shoppingGuidesHeadlines
widget lets you reference and render different shopping guides on your website.
Installation
The Algolia Shopping Guides JavaScript package is available on the npm registry.
1
2
3
yarn add @algolia/generative-experiences-js
# or
npm install @algolia/generative-experiences-js
Usage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { createClient } from '@algolia/generative-experiences-api-client';
import {
shoppingGuidesHeadlines,
} from '@algolia/generative-experiences-js';
const client = createClient({
appId: 'YourApplicationID',
indexName: 'your_index_name',
searchOnlyAPIKey: 'YourSearchOnlyAPIKey',
region: 'us',
});
shoppingGuidesHeadlines({
container: '#headlines',
client: client,
userToken: 'test-user',
showImmediate: true,
showFeedback: true,
category: 'category',
});
Parameters
client
|
type: GSEClient
Required
The initialized Algolia Generative Experiences client. |
||
category
|
type: string
Required
The category used for retrieving the headlines. |
||
nbHeadlines
|
type: number
The number of headlines to display. Default: 4 |
||
onlyPublished
|
type: boolean
Whether to only return headlines with generated content. Default: |
||
showImmediate
|
type: boolean
Whether to generate and display the headlines on load. Default: |
||
showFeedback
|
type: boolean
Whether to show the feedback widget. Default: |
||
userToken
|
type: string
The user token needed for computing feedback. |
||
children
|
type: (props: ChildrenProps) => JSX.Element
A render function to fully customize what’s displayed. The default implementation is:
Copy
|
||
view
|
type: ViewProps
The view component into which your shopping guide headlines will be rendered. The default implementation is:
Copy
|
||
itemComponent
|
type: ({ item, createElement, Fragment, html }) => JSX.Element | VNode | VNode[]
Component to display the headlines. |
||
classNames
|
type: HeadlinesButtonClassNames
The class names for the component.
Copy
|