File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change 1414</template >
1515
1616<script setup>
17+ import { ref , watch } from " vue" ;
1718import { showingNavigationMenu } from " ./globals.js"
1819import { Head } from " @unhead/vue/components" ;
1920import { useRoute } from " vue-router" ;
2021
2122import Navigation from " ./components/Navigation" ;
2223
2324const route = useRoute ();
24- const { title , description , image } = useRoute ()? .meta ;
25+
26+ // load route metadata for initial-server side render
27+ const title = ref (route? .meta ? .title );
28+ const description = ref (route? .meta ? .description );
29+ const image = ref (route? .meta ? .image );
30+
31+ watch (route, (to ) => {
32+ // update route metadata on client-side navigation
33+ title .value = to? .meta ? .title ;
34+ description .value = to? .meta ? .description ;
35+ image .value = to? .meta ? .image ;
36+ }, {flush: ' pre' , immediate: true , deep: true });
37+
2538< / script>
2639
2740< style lang= " scss" >
You can’t perform that action at this time.
0 commit comments