Menu
CoddyTech

Route Metadata

Part of the Routing and State section of Coddy's Vue journey. Lesson 28 of 55.

Route metadata attaches application-defined information to a record. A shell can read the current route metadata for labels, while a guard can later use policy flags. Metadata keys are your app convention rather than special rendering commands.

{path:'/library',component:Library,meta:{label:'Reading room'}}
// In the shell:
const route=useRoute();
// <p>{{ route.meta.label || 'Community' }}</p>

Keep rendered metadata reads reactive and define a fallback for records without the key. Nested route metadata is a non-recursive merge of matched parent and child metadata: a child can override a parent key. The router does not automatically turn a label field into a browser title.

challenge icon

Challenge

Medium

Store the supplied page labels in route meta.title: Home is Visitor desk, Calendar is Calendar, Help is Help. Render the current label reactively in shell p#page-title. This is visible shell text, not a browser document-title update.

Keep the supplied route readout and bootstrap files.

Try it yourself

<!doctype html><html><head><meta charset="UTF-8"><title>Routing practice</title></head><body><div id="app"></div><script type="module" src="./main.js"></script></body></html>
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Routing and State