Skip to content

Commit d5a6c1f

Browse files
committed
refactor(routing): update title formating
1 parent 6095057 commit d5a6c1f

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

src/router/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ router.beforeEach((to, from, next) => {
2929
// const previousNearestWithMeta = from.matched.slice().reverse().find(r => r.meta && r.meta.metaTags);
3030

3131
// If a route with a title was found, set the document (page) title to that value.
32-
if(nearestWithTitle) document.title = nearestWithTitle.meta.title;
32+
if(nearestWithTitle) document.title = to.path !== '/' ? `${nearestWithTitle.meta.title} | Vue Zephyr` : nearestWithTitle.meta.title;
3333
if(!nearestWithTitle) document.title = 'Vue Zephyr'; // Fall back if there is no title set
3434

3535
// Remove any stale meta tags from the document using the key attribute we set below.

src/views/pages/docs/anchor.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ export default defineComponent({
255255
{
256256
"name": "anchor",
257257
"meta": {
258-
"title": "Anchor | Vue Zephyr",
258+
"title": "Anchor",
259259
"metaTags": [
260260
{
261261
"property": "og:title",
262-
"content": "Anchor | Vue Zephyr"
262+
"content": "Anchor"
263263
},
264264
{
265265
"name": "twitter:title",
266-
"content": "Anchor | Vue Zephyr"
266+
"content": "Anchor"
267267
},
268268
{
269269
"name": "description",

src/views/pages/docs/button.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -292,15 +292,15 @@ export default defineComponent({
292292
{
293293
"name": "button",
294294
"meta": {
295-
"title": "Button | Vue Zephyr",
295+
"title": "Button",
296296
"metaTags": [
297297
{
298298
"property": "og:title",
299-
"content": "Button | Vue Zephyr"
299+
"content": "Button"
300300
},
301301
{
302302
"name": "twitter:title",
303-
"content": "Button | Vue Zephyr"
303+
"content": "Button"
304304
},
305305
{
306306
"name": "description",

src/views/pages/docs/dropdown.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -528,15 +528,15 @@ export default defineComponent({
528528
{
529529
"name": "dropdown",
530530
"meta": {
531-
"title": "Dropdown | Vue Zephyr",
531+
"title": "Dropdown",
532532
"metaTags": [
533533
{
534534
"property": "og:title",
535-
"content": "Dropdown | Vue Zephyr"
535+
"content": "Dropdown"
536536
},
537537
{
538538
"name": "twitter:title",
539-
"content": "Dropdown | Vue Zephyr"
539+
"content": "Dropdown"
540540
},
541541
{
542542
"name": "description",

src/views/pages/docs/guides.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ export default defineComponent({
5757
{
5858
"name": "guides",
5959
"meta": {
60-
"title": "Guides (coming soon) | Vue Zephyr",
60+
"title": "Guides (coming soon)",
6161
"metaTags": [
6262
{
6363
"property": "og:title",
64-
"content": "Guides (coming soon) | Vue Zephyr"
64+
"content": "Guides (coming soon)"
6565
},
6666
{
6767
"name": "twitter:title",
68-
"content": "Guides (coming soon) | Vue Zephyr"
68+
"content": "Guides (coming soon)"
6969
},
7070
{
7171
"name": "description",

src/views/pages/docs/install.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ export default defineComponent({
133133
{
134134
"name": "install",
135135
"meta": {
136-
"title": "Installation | Vue Zephyr",
136+
"title": "Installation",
137137
"metaTags": [
138138
{
139139
"property": "og:title",
140-
"content": "Installation | Vue Zephyr"
140+
"content": "Installation"
141141
},
142142
{
143143
"name": "twitter:title",
144-
"content": "Installation | Vue Zephyr"
144+
"content": "Installation"
145145
},
146146
{
147147
"name": "description",

src/views/pages/docs/prose.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ export default defineComponent({
4747
{
4848
"name": "prose",
4949
"meta": {
50-
"title": "Prose | Vue Zephyr",
50+
"title": "Prose",
5151
"metaTags": [
5252
{
5353
"property": "og:title",
54-
"content": "Prose | Vue Zephyr"
54+
"content": "Prose"
5555
},
5656
{
5757
"name": "twitter:title",
58-
"content": "Prose | Vue Zephyr"
58+
"content": "Prose"
5959
},
6060
{
6161
"name": "description",

src/views/pages/docs/starter.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default defineComponent({
1616
{
1717
"name": "starter",
1818
"meta": {
19-
"title": "Starter | Vue Zephyr",
19+
"title": "Starter",
2020
"metaTags": [
2121
{
2222
"property": "og:title",

src/views/pages/docs/table.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ export default defineComponent({
4545
{
4646
"name": "table",
4747
"meta": {
48-
"title": "Table | Vue Zephyr",
48+
"title": "Table",
4949
"metaTags": [
5050
{
5151
"property": "og:title",
52-
"content": "Table | Vue Zephyr"
52+
"content": "Table"
5353
},
5454
{
5555
"name": "twitter:title",
56-
"content": "Table | Vue Zephyr"
56+
"content": "Table"
5757
},
5858
{
5959
"name": "description",

src/views/pages/docs/theming.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default defineComponent({
3636
{
3737
"name": "theming",
3838
"meta": {
39-
"title": "Theming | Vue Zephyr",
39+
"title": "Theming",
4040
"metaTags": [
4141
{
4242
"property": "og:title",

src/views/pages/guides/index.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ export default defineComponent({
4545
{
4646
"name": "guides-redirect",
4747
"meta": {
48-
"title": "Redirect | Vue Zephyr",
48+
"title": "Redirect",
4949
"metaTags": [
5050
{
5151
"property": "og:title",
52-
"content": "Redirect | Vue Zephyr"
52+
"content": "Redirect"
5353
},
5454
{
5555
"name": "twitter:title",
56-
"content": "Redirect | Vue Zephyr"
56+
"content": "Redirect"
5757
},
5858
{
5959
"name": "description",

0 commit comments

Comments
 (0)