In the module assessment of module 13 in answers track, I am unable to find my mistakes. I am attaching the photos of error as well as my code in reply. Please help.
Hi Abhishek,
There are a few issues here:
Add Searchable Fields for the Community Stories Vertical
For the c_goal field you are not specifying what kind of searchable field it should be as your object is empty. Make sure that it looks more like this:
"c_goal": {
"textSearch"
}
Add and update the page for Community Stories
The verticalKey is case sensitive. As you can see in your screenshot for the search configuration, the verticalKey is camelcase not all lowercase. You should always double check that these match exactly. You’ll want to update the verticalKey in both places in your communitystories.json file to communityStories
. You should have noticed this was an issue if you were using Live Preview - you should make sure you are following the directions and doing so as it will help you debug this as you’re going through it.
Add a new card called communitystory and update data mappings
You’ve correctly added the subtitle which looks great! The issue is with the url on CTA1. The formatter generateCTAFieldTypeLink
can only be used with fields that are of the built-in type “Call to Action” (the formatter is specifically taking the link type and combining it with the link to produce the right output depending on if the link type is URL, email or phone number). In this case, you just want the url so you don’t need a formatter, but just profile.landingPageUrl
. Again, you would have noticed this in live preview as there would have been a frontend error. If you inspected the page and looked at the console, you would see an error that explicitly states that the URL does not have a Link Type (e.g. ,the formatter is erroring, which hopefully would have pointed you to this!).
#1 advice here: Use the Live Preview as you’re building. It will help you to identify issues as you’re coding them.
Hey Team,
I too am having some struggles with Module 13 and can’t pinpoint the issue. All that remains for me is "Add a new card called communitystory and update data mappings
". I’ve attached my search configuration along config > communitystories.json and cards > communitystory > component.js
It’s a small detail, but can you make sure there’s a space after In partnership with:
- the line should read:
subtitle: 'In partnership with: ' + Formatter.joinList(profile.c_localNonProfits),
Thanks Amani!
Got a little assistance from Elie and it was that and I needed to update profile.landingPageURL to be profile.landingPageUrl. Bad spacing and casing on my end
Hello Team,
I have problem with this module assessment.
I always fail the last step: “Add a new card called communitystory and update data mappings”.
I can’t understand where I’m wrong.
Thanks
A small detail here, but the CTA1 Label is expecting single quotes. It should read:
label: 'Learn More',
Sam
Thank you very much!!!
Finally
Hi team,
I have tried to finish this assessment a couple of times but I am still getting an error for this part “Add a new card called communitystory and update data mappings”.
Could you please assist?
Here is the code:
{
"verticalKey": "community_stories", // The vertical key from your search configuration
"pageTitle": "Community Story Search", // !!!REPLACE THIS VALUE!!! The contents of the title tag and meta open graph tag for title
// "metaDescription": "", // The meta tag for open graph description
// "canonicalUrl": "", // The link tag for canonical URL as well as the meta tag for open graph url
// "keywords": "", // The meta tag for keywords
"pageSettings": {
"search": {
"verticalKey": "community_stories", // The vertical key from your search configuration
"defaultInitialSearch": "" // Enter a default search term
}
},
"componentSettings": {
/**
"QASubmission": {
"entityId": "", // Set the ID of the entity to use for Q&A submissions, must be of entity type "Organization"
"privacyPolicyUrl": "" // The fully qualified URL to the privacy policy
},
**/
/**
"Facets": {
"expand": false, // Allow the user to expand and collapse the facets
"showMore": false, // Display a link to see more facet options within a facet
"searchOnChange": true // Will automatically run a search as facets are selected or unselected. Set to false to only trigger updates with an Apply button.
// Additional options are available in the documentation
},
**/
/**
"FilterLink": {
"changeFiltersText": "sorts and filters", // Text that displays by default
"resetFiltersText": "reset filters", // Text when filters are applied
"clearSearchText": "clear search" // Text when there are no results, conducts an empty search
},
**/
"AppliedFilters": {
"removable": true
},
"VerticalResults": {
"noResults": {
"displayAllResults": true // Optional, whether to display all results in the vertical when no results are found.
},
"hideResultsHeader": true
},
"SearchBar": {
"placeholderText": "Search", // The placeholder text in the answers search bar
"allowEmptySearch": true // Allows users to submit an empty search in the searchbar
},
"Pagination": {
"noResults": {
"visible": true
}
}
},
// Configuration used to define the look and feel of the vertical, both on this page and, by default,
// on the universal page.
"verticalsToConfig": {
"community_stories": { // The vertical key from your search configuration
"label": "Community Stories", // The name of the vertical in the section header and the navigation bar
// "verticalLimit": 15, // The result count limit for vertical search
// "universalLimit": 5, // The result count limit for universal search
"cardType": "communitystory", // The name of the card to use - e.g. accordion, location, customcard
"icon": "star", // The icon to use on the card for this vertical
"universalSectionTemplate": "standard"
}
}
}
_________
{{> cards/card_component componentName='communitystory' }}
class communitystoryCardComponent extends BaseCard['communitystory'] {
constructor(config = {}, systemConfig = {}) {
super(config, systemConfig);this.setTemplate(`{{{read 'cards/communitystory/template' }}}`);
}
/**
* This returns an object that will be called `card`
* in the template. Put all mapping logic here.
*
* @param profile profile of the entity in the card
*/
dataForRender(profile) {
const linkTarget = AnswersExperience.runtimeConfig.get('linkTarget') || '_top';
return {
title: profile.name, // The header text of the card
url: profile.website || profile.landingPageUrl, // If the card title is a clickable link, set URL here
target: linkTarget, // If the title's URL should open in a new tab, etc.
// image: '', // The URL of the image to display on the card
// altText: '', // The alternate text for the image
titleEventOptions: this.addDefaultEventOptions(),
subtitle: 'In partnership with: ' + Formatter.joinList(profile.c_localNonProfits), // The sub-header text of the card
details: profile.description, // The text in the body of the card
// If the card's details are longer than a certain character count, you can truncate the
// text. A toggle will be supplied that can show or hide the truncated text.
showMoreDetails: {
showMoreLimit: 250, // Character count limit
showMoreText: 'Show more', // Label when toggle will show truncated text
showLessText: 'Show less' // Label when toggle will hide truncated text
},
// The primary CTA of the card
CTA1: {
label: 'Learn More', // The CTA's label
iconName: 'chevron', // The icon to use for the CTA
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA), // The URL a user will be directed to when clicking
target: linkTarget, // Where the new URL will be opened
eventType: 'CTA_CLICK', // Type of Analytics event fired when clicking the CTA
eventOptions: this.addDefaultEventOptions(),
// ariaLabel: '', // Accessible text providing a descriptive label for the CTA
}
};
}
}
/**
* The template to render
* @returns {string}
* @override
*/
static defaultTemplateName (config) {
return 'cards/communitystory';
}
}
ANSWERS.registerTemplate(
'cards/communitystory',
{{{stringifyPartial (read 'cards/communitystory/template') }}}
);
ANSWERS.registerComponentType(communitystoryCardComponent);
Thank you,
Hi @Juan_Bustillos ,
I believe the error is coming from one of the CTA 1 data mappings on the communitystory card you created.
In step 9 of the challenge instructions, it specifies mapping the CTA 1 URL to profile.landingPageUrl
but it looks like the URL is still mapped to Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA)
on your card.
Hope this helps!
DJ
Hi @DJ_Corbett
Ah! I thought that was already done, all good now, thank you!