Challenge Help - Creating a new vertical end to end

In Answers track, in module 13, I am unable to get the CTA lable (learn more), Is the code that I attached correct?

Hi Challoju,

You’re so close! The issue is with the subtitle.

In the screenshot above you have
subtitle: profile.c_localNonProfits ? 'In partnership with: ' + profile.c_localNonProfits : null,

This is great javascript! You are checking to see if the field has a value and then stating the action if true and false.
condition ? action if true : action if false

The rule is looking for something a bit simpler, but we will adjust the rule checker to accommodate this level of expertise. In the meantime, I recommend removing the null check and just using the true statement assuming that c_localNonProfits will always be filled out.

The last piece is when you’re joining a list by default it will just use a comma delimiter, but to make it more human-readable you’ll want the delimiter to be ", " (with a space). I took a look at your account and right now you have:

subtitle: 'In partnership with:', // The sub-header text of the card details: profile.description, // The text in the body of the card c_localNonProfits: Formatter.joinList(profile.c_localNonProfits),

This is incorrect because you’ve made c_localNonProfits an attribute that is not present in your template.hbs for the card. You’ll want to make sure to remove that and only update the subtitle attribute. But you will want to use that formatter. Keep in mind that the formatter can optionally take a separator:
joinList(list, separator)

Ex:
joinList(c_textListField, ', ')

Here’s a good unit to look at for guidance: Defining New Cards | Hitchhikers

Thanks,
Liz


I used CTA label : learn more , but I can’t get it in output.

subtitle: ‘In partnership with: ’ + Formatter.joinList(profile.c_localNonProfits,’,')
Is this how we include both ‘In partnership with’ and formatter ?

For the CTA Label, you can Inspect the live preview page (right click on the page and then click Inspect) and look at the console to identify errors like this. Here’s the error I see when I inspect your experience:

“CTA doesn’t have a linkType”.

This is because you are using the CTA Field Type formatter on a field that is not a CTA field.
url: Formatter.generateCTAFieldTypeLink(profile.landingPageUrl), is incorrect. It would either need to be:

A field that is a “CTA type” field:
url: Formatter.generateCTAFieldTypeLink(profile.c_primaryCTA),

or

Remove the formatter and use a simple URL field:

url: profile.landingPageUrl,

For the subtitle, what you listed looks good:
subtitle: 'In partnership with: ' + Formatter.joinList(profile.c_localNonProfits,',')

Thanks!
Liz

1 Like

Hey again @Liz_Frailey ,

Thanks for this previous answer that helped me much : I had the same error than Challoju with the wrong type of format for the landingPageUrl field.
The error is corrected and everything “seems” to be displayed correctly, but when submitting the challenge again, I still have this “Add a new card called communitystory and update data mappings” error.
Here is my sandbox : https://sandbox.yext.com/s/2502750/sitesgit/r/3335/

Do you think I made another mistake ? Is this a bug ? I cannot find anything more on my side …
Thanks in advance for your help.

Hi Nicolas,

You’re so close!

It looks like you have a grammatical error:
subtitle: 'In partnership with :'

or

subtitle: 'In partnership with: '

That should do the trick :slightly_smiling_face:

Thanks!
Liz

Damn … you were right, that was the extra space before “:” (french punctuation …).
I was so focused on objects, functions, fields, etc … that I totally missed that simple mistake :confused:
Sorry for that, but thanks a lot for your help !!

Hi @Liz_Frailey,

I’m running into a couple issues here as well, namely I’m failing on “Add and update the page for Community Stories” and “Add a new card called communitystory and update data mappings”. I’m really not sure what I’ve done wrong as I’ve followed all of the comments above but still can’t pass, any help is appreciated! My Sandbox account is here.

I’ve attached a couple of screenshots of the code editor as well below. Any help would be appreciated!

You’re also a wizz @Jason_Ronkin, please can you guide me if you have the time?

Hi Scott,

Did you try creating a live preview of the site? This should have highlighted that there were some issues with the code. There are a couple of things I noticed:

  • You need to update the verticalKey (in both places) in the communitystories.json file. The verticalKey is not the same as the API name for the entity type. The verticalKey is the unique key in the verticals object of the search configuration (which in this challenge should be communityStories). In Live Preview, you can notice this because the Community Stories vertical is being returned but without any styling – this is because it’s using the default of the SDK since it doesn’t think you’ve defined this vertical at all in the frontend (due to the invalid key)

    Current page:

    Page you want:

  • For the communitystory card, you have an error in the subtitle. In your current code you have:
    subtitle: 'In partnership with: Formatter.joinList(profile.c_localNonProfits),',
    The problem is that you have the whole string encased in quotes. This would quite literally print out the string on your card: ‘In partnership with: Formatter.joinList(profile.c_localNonProfits),’. However, you don’t want that!

    Current card:

    Card you want:

    Make sure that you only have quotes around the hardcoded string (In partnership with: ). You can then use " + " to connect the string with the Formatter.

Hope this helps!
Liz

Hi everyone and thanks for the tips above. I’ve checked for the above errors and gone through the challenge from scratch a few times now, but am still having an issue passing all of the requirements (esp. the final one where it asks to" Add a new card called communitystory and update data mappings". Could someone take a look and save my sanity? Thank you!

link to sandbox account: https://sandbox.yext.com/s/2507648/sites/14760/publishing/?env=staging

Hi Sarah,

The issue is with the label. The challenge is asking for just a string and you’re enclosing it in a formatter which is not necessary.

You have:
label: profile.c_primaryCTA ? "Learn More" : null, // The CTA's label

All you need is:
label: 'Learn More',

Thanks!
Liz

1 Like

that worked, thank you! sweet victory!

Hi Liz,

I am having a similar problem updating CTA and subtitle section for this module. Please see my code here:

Thank you!

Hey Jenna! I would take out the part where it says " : null," in line 34 and see if that helps. I think you still have the second half of the formatter in there but the code editor may not know what to do with it since you removed the first half.