Skip to content

Commit bef240f

Browse files
committed
Feat: Added Open Graph meta tags, Twitter Card's meta tags and modified the comments
1 parent 05e913d commit bef240f

File tree

2 files changed

+85
-6
lines changed

2 files changed

+85
-6
lines changed

pages/blog/_blogpost.vue

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ export default {
2424
Header,
2525
Footer
2626
},
27-
// The head function generates all the metadata for the HTML's head, in this case, title, description and keywords (for SEO purposes)
28-
// Also includes twitter:card headers for correct parsing in Twitter
27+
// The head function generates all the metadata for the HTML's head
2928
head: function() {
3029
return {
3130
title: `${this.post.title}`,
3231
meta: [
32+
// SEO meta
3333
{
3434
hid: "description",
3535
name: "description",
@@ -40,6 +40,33 @@ export default {
4040
name: "keywords",
4141
content: this.post.keywords
4242
},
43+
// Facebook's Open Graph Markup
44+
{
45+
hid: "og:url",
46+
property: "og:url",
47+
content: this.fullURL
48+
},
49+
{
50+
hid: "og:type",
51+
property: "og:type",
52+
content: "article"
53+
},
54+
{
55+
hid: "og:title",
56+
property: "og:title",
57+
content: this.post.title
58+
},
59+
{
60+
hid: "og:description",
61+
property: "og:description",
62+
content: this.post.description
63+
},
64+
{
65+
hid: "og:image",
66+
property: "og:image",
67+
content: this.imageURL
68+
},
69+
// Twitter's Card Markup
4370
{
4471
hid: "twitter:card",
4572
name: "twitter:card",
@@ -74,9 +101,13 @@ export default {
74101
Prism.highlightAll();
75102
},
76103
computed: {
77-
// image will always return the correct URL for the thumbnail, both for development and once deployed
104+
// imageURL will always return the correct URL for the thumbnail, both for development and once deployed
78105
imageURL: function() {
79-
return `${process.env.BASE_URL}${this.post.thumbnail}`
106+
return `${process.env.BASE_URL}${this.post.thumbnail}`;
107+
},
108+
// fullURL will always return the correct URL for the og:URL, both for development and once deployed
109+
fullURL: function() {
110+
return `${process.env.BASE_URL}${this.$route.path}`;
80111
}
81112
}
82113
};

pages/index.vue

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,69 @@ export default {
2828
ArticleCard,
2929
Footer
3030
},
31-
// The head function generates all the metadata for the HTML's head, in this case, title, description and keywords (for SEO purposes)
31+
// The head function generates all the metadata for the HTML's head
3232
head() {
3333
return {
3434
title: "Israel Muñoz",
3535
meta: [
36+
// SEO meta
3637
{
3738
hid: "description",
3839
name: "description",
39-
content: "A blog about Web Development"
40+
content: "A blog about Web Development, entrepeneurship, and education."
4041
},
4142
{
4243
hid: "keywords",
4344
name: "keywords",
4445
content:
4546
"Full Stack full-stack node.js nodejs express vue nuxt landing blog javascript jamstack"
47+
},
48+
// Facebook's Open Graph Markup
49+
{
50+
hid: "og:url",
51+
property: "og:url",
52+
content: "https://israelmuca.dev"
53+
},
54+
{
55+
hid: "og:type",
56+
property: "og:type",
57+
content: "website"
58+
},
59+
{
60+
hid: "og:title",
61+
property: "og:title",
62+
content: "Hello! I'm Israel Muñoz, a Full Stack Web Developer. I'm currently working in expanding access to computer science in mexican schools."
63+
},
64+
{
65+
hid: "og:description",
66+
property: "og:description",
67+
content: "A blog about Web Development, entrepeneurship, and education."
68+
},
69+
{
70+
hid: "og:image",
71+
property: "og:image",
72+
content: "https://avatars3.githubusercontent.com/u/15834664?s=400&u=428efa70328b335936bcfc500272a48234e803c6&v=4"
73+
},
74+
// Twitter's Card Markup
75+
{
76+
hid: "twitter:card",
77+
name: "twitter:card",
78+
content: "summary_large_image"
79+
},
80+
{
81+
hid: "twitter:title",
82+
name: "twitter:title",
83+
content: "Hello! I'm Israel Muñoz, a Full Stack Web Developer. I'm currently working in expanding access to computer science in mexican schools."
84+
},
85+
{
86+
hid: "twitter:description",
87+
name: "twitter:description",
88+
content: "A blog about Web Development, entrepeneurship, and education."
89+
},
90+
{
91+
hid: "twitter:image",
92+
name: "twitter:image",
93+
content: "https://avatars3.githubusercontent.com/u/15834664?s=400&u=428efa70328b335936bcfc500272a48234e803c6&v=4"
4694
}
4795
]
4896
};

0 commit comments

Comments
 (0)