Answers Final Challenge - Add Jobs vertical page to the Jobs experience/Add custom job card to the Jobs experience error

Hello,

I am having two errors and I can not for the life of me figure out what I’m doing wrong. Can you please take a look and let me know where I’m going wrong, I have looked back in the modules and in this community and have not figured it out.

  1. Add Jobs vertical page to the Jobs experience
  2. Add custom job card to the Jobs experience error

Below is my code for #1:

{
“verticalKey”: “jobs”, // The vertical key from your search configuration
“pageTitle”: “Job 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”: “jobs”, // 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”: {
“jobs”: { // The vertical key from your search configuration
// “label”: “”, // 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”: “job-joboverride”, // The name of the card to use - e.g. accordion, location, customcard
“icon”: “briefcase”, // The icon to use on the card for this vertical
“universalSectionTemplate”: “standard”
}
}
}

and #2
{{> cards/card_component componentName=‘joboverride’ }}

class joboverrideCardComponent extends BaseCard[‘joboverride’] {
constructor(config = {}, systemConfig = {}) {
super(config, systemConfig);
}

/**

  • 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) {
    return {
    title: profile.name, // The header text of the card
    url: profile.landingPageUrl, // If the card title is a clickable link, set URL here
    target: ‘_top’, // If the title’s URL should open in a new tab, etc.
    // image: ‘’, // The URL of the image to display on the card
    // tagLabel: ‘’, // The label of the displayed image
    titleEventOptions: this.addDefaultEventOptions(),
    profile.c_department + “|” + profile.employmentType, // 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: 500, // 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: ‘Apply Now’, // The CTA’s label
    iconName: ‘briefcase’, // The icon to use for the CTA
    url: ‘http://careers.turtleheadtacos.com’, // The URL a user will be directed to when clicking
    target: ‘_top’, // 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/joboverride’;
    }
    }

ANSWERS.registerTemplate(
‘cards/joboverride’,
{{{stringifyPartial (read ‘cards/joboverride/template’) }}}
);
ANSWERS.registerComponentType(joboverrideCardComponent);

I Updated the card code to the below:

{{> cards/card_component componentName=‘joboverride’ }}

class joboverrideCardComponent extends BaseCard[‘joboverride’] {
constructor(config = {}, systemConfig = {}) {
super(config, systemConfig);
}

/**

  • 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) {
    return {
    title: profile.name, // The header text of the card
    url: profile.landingPageUrl, // If the card title is a clickable link, set URL here
    target: ‘_top’, // If the title’s URL should open in a new tab, etc.
    // image: ‘’, // The URL of the image to display on the card
    // tagLabel: ‘’, // The label of the displayed image
    titleEventOptions: this.addDefaultEventOptions(),
    subtitle: profile.c_jobDepartment + ’ | ’ + profile.employmentType, // 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: 500, // 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: ‘Apply Now’, // The CTA’s label
    iconName: ‘briefcase’, // The icon to use for the CTA
    url: ‘http://careers.turtleheadtacos.com’, // The URL a user will be directed to when clicking
    target: ‘_top’, // 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/joboverride’;
    }
    }

ANSWERS.registerTemplate(
‘cards/joboverride’,
{{{stringifyPartial (read ‘cards/joboverride/template’) }}}
);
ANSWERS.registerComponentType(joboverrideCardComponent);

Hey Natalie,

Welcome to the Community! You’re very close.

For #1 on adding the jobs page to Jobs experience, you’ve got a typo in the first verticalKey with an extra >. The experience isn’t able to read in the page with an incorrect vertical key.

For #2 on adding a custom job card to the job experience, your code in the second post above is actually correct. However, your code editor currently has incorrect code for subtitle. The correct code is subtitle: profile.c_jobDepartment + ’ | ’ + profile.employmentType,. Please be sure to update it and commit before submitting. You may need to update the single quotes when you copy it in (' vs ’ - just delete it and re-enter it if it looks wonky).

After these two updates, you should be good to go, but please reach out with any other issues!

Hello!

For #1 I changed the code to the below and am still showing its not being accepted:

{
“verticalKey”: “jobs”, // The vertical key from your search configuration
“pageTitle”: “Job 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”: “jobs”, // 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”: {
“jobs”: { // The vertical key from your search configuration
// “label”: “”, // 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”: “job-override”, // The name of the card to use - e.g. accordion, location, customcard
“icon”: “briefcase”, // The icon to use on the card for this vertical
“universalSectionTemplate”: “standard”
}
}
}

For #2

{{> cards/card_component componentName=‘joboverride’ }}

class joboverrideCardComponent extends BaseCard[‘joboverride’] {
constructor(config = {}, systemConfig = {}) {
super(config, systemConfig);
}

/**

  • 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) {
    return {
    title: profile.name, // The header text of the card
    url: profile.landingPageUrl, // If the card title is a clickable link, set URL here
    target: ‘_top’, // If the title’s URL should open in a new tab, etc.
    // image: ‘’, // The URL of the image to display on the card
    // tagLabel: ‘’, // The label of the displayed image
    titleEventOptions: this.addDefaultEventOptions(),
    subtitle: [jobDepartment] ‘|’ [employmentType], // 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: 500, // 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: ‘Apply Now’, // The CTA’s label
    iconName: ‘briefcase’, // The icon to use for the CTA
    url: ‘http://careers.turtleheadtacos.com’, // The URL a user will be directed to when clicking
    target: ‘_top’, // 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/joboverride’;
    }
    }

ANSWERS.registerTemplate(
‘cards/joboverride’,
{{{stringifyPartial (read ‘cards/joboverride/template’) }}}
);
ANSWERS.registerComponentType(joboverrideCardComponent);

Changed it to this… But still nothing

Looks like you just needed to restart the session on your Code Editor and commit that code. Glad it worked!