@kiwicom/smart-faq
Version:
Smart FAQ
38 lines (26 loc) • 1.88 kB
Markdown
id: link-to-faqs
title: How to create link to FAQs
sidebar_label: Link to FAQs
## TL;DR
Look into `SmartFAQDuck.js` in [frontend/frontend](https://gitlab.skypicker.com/frontend/frontend/blob/c9fad169db5e2d9dc0211fa98bed9633171ee95b/src/common/modules/SmartFAQ/services/SmartFAQDuck.js) how to open FAQ article.
## How routing in SmartFAQ works
As customer navigates though SmartFAQ, "url" is synced into `?help=` query parameter. Specific articles are accessible under route `/faq/{categoryId}/article/{articleId}` and `/faq/search/article/{articleId}`.
For example [https://www.kiwi.com/en/?help=%2Ffaq%2FRkFRQ2F0ZWdvcnk6ODg%3D%2Farticle%2FRkFRQXJ0aWNsZTo0MQ%3D%3D](https://www.kiwi.com/en/?help=%2Ffaq%2FRkFRQ2F0ZWdvcnk6ODg%3D%2Farticle%2FRkFRQXJ0aWNsZTo0MQ%3D%3D) points to `Cabin baggage` article in `Baggage` category.
### Open FAQs only
When you want to open FAQ article after clicking on some *"show more"* article to open specific FAQ, it's unwanted to show there in SmartFAQ also booking info in case user is logged. You can disable displaying booking info in SmartFAQ completely by adding `faqsOnly=1` query param. Solved for you if you use `SmartFAQDuck.js` above.
## How to add link to new article
1. Add new constant into `SmartFAQDuck.js`, see [frontend/frontend](https://gitlab.skypicker.com/frontend/frontend/blob/c9fad169db5e2d9dc0211fa98bed9633171ee95b/src/common/modules/SmartFAQ/services/SmartFAQDuck.js)
2. Provide both numerical id (corresponds to id in knowledgebase) and GraphQL opaque id. GraphQL id is basically base64 encoded string `FAQArticle:{yourNumericalId}`. You can verify that it works by the query below on [GraphQL](https://graphql.kiwi.com):
```graphql
query {
FAQArticle(id: "...") {
id
originalId
title
content
}
}
```
*Note:* it shouldn't be necessary to provide GraphQL opaque ids in future :).