diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..df3ddcba6 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.json linguist-language=JSON-with-Comments \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 000000000..8144925d1 --- /dev/null +++ b/README.md @@ -0,0 +1,74 @@ +# Answers Hitchhiker Theme + +A [Jambo](https://github.com/yext/jambo) theme for building Answers experiences. + +Additonal resources for integrating Answers can be found at https://hitchhikers.yext.com/. + +Need help? Ask a question in the [Hitchhiker's Community](https://hitchhikers.yext.com/community/c/answers). + +## Getting Started + +### Prerequisites +- Jambo, a static site generator, which can be installed with `npm i jambo` +- An Answers experience configured at https://yext.com. This will provide the `experienceKey` and the `apiKey` + +### Creating an Answers site + +Inside a new directory, initialize jambo with the theme: +```bash +npx jambo init --theme answers-hitchhiker-theme +``` + +Add a universal search page: +```bash +npx jambo page --name index --template universal-standard +``` + +Inside config/global_config.json, delete the "//" before "apiKey" and enter your `apiKey`. Do the same for the `experienceKey` inside config/locale_config.json. +You can find examples inside test-site/config. + +Build the site: +```bash +npx jambo build && grunt webpack +``` + +Finally, serve the site: +```bash +npx serve public +``` + +The site should now be available at http://localhost:5000. + +## Custom Jambo Commands + +This theme makes the following commands available when Jambo imports this theme. + +### Vertical Command +Creates a vertical page of an Answers experience. + +Example usage: +```bash +npx jambo vertical --name Locations --verticalKey locations --template vertical-standard +``` + +See `jambo vertical --help` for more info. + +### Card Command +Creates a new, custom card based on an existing card. + +Example usage: +```bash +npx jambo card --name custom-location --templateCardFolder cards/location-standard +``` + +See `jambo card --help` for more info. + +### Direct Answer Card +Creates a new, custom direct answer card. + +Example usage: +```bash +npx jambo directanswercard --name custom-directanswer --templateCardFolder directanswercards/allfields-standard +``` + +See `jambo directanswercard --help` for more info. \ No newline at end of file diff --git a/cards/faq-accordion/component.js b/cards/faq-accordion/component.js index dd2c828ca..d17b0a632 100644 --- a/cards/faq-accordion/component.js +++ b/cards/faq-accordion/component.js @@ -13,7 +13,7 @@ class faq_accordionCardComponent extends BaseCard['faq-accordion'] { */ dataForRender(profile) { return { - title: profile.name, // The header text of the card + title: profile.question || profile.name, // The header text of the card // subtitle: '', // The sub-header text of the card details: profile.answer ? ANSWERS.formatRichText(profile.answer, "answer", "_top") : null, // The text in the body of the card // If the card's details are longer than a certain character count, you can truncate the diff --git a/cards/faq-accordion/template.hbs b/cards/faq-accordion/template.hbs index dae229732..944e712c0 100644 --- a/cards/faq-accordion/template.hbs +++ b/cards/faq-accordion/template.hbs @@ -21,7 +21,7 @@ {{/if}} {{> 'details'}} - {{#if (any (all card.CTA1 card.CTA1.url) (all card.CTA2 card.CTA2.url))}} + {{#if (any (all card.CTA1 card.CTA1.url card.CTA1.label) (all card.CTA2 card.CTA2.url card.CTA2.label))}}