Custom Templates
Vue-based themes will soon be deprecated. Please switch to React-based themes, as all future updates and support will focus exclusively on React.
What is a custom template?
Custom templates are Vue templates that you can use in your theme if none of the available system pages meet your requirements. These templates are mounted at /c/page-name
routes. An instance of the application SDK is available in case the template needs to display any data in the UI.
Creating a custom template
Inside your theme/custom-templates
, folder create a new VUue file, for example, notifications.vue
. Now create an index.js file in the theme``/custom-templates
folder. Import the notification component inside this file. You need to now default export an object with the list of all components.
Use the below snippet as a reference:
import Notification from './notification.vue';
export default {
// mount at /c/notication
notification: {
component: Notification,
meta: {
header: false,
footer: false,
}
}
}
"The meta object has two keys: 'header' and 'footer.' You can set them as true or false to show/hide the header and footer on your custom page. We have set both to false as we do not want to show the header and footer in our custom template. When serving the site locally, you can view this page at http://localdev.fynd.com:5000/c/notification
. The notification
part in the route comes from the key in the default exported object."