Skip to content

Commit

Permalink
add description meta tag
Browse files Browse the repository at this point in the history
  • Loading branch information
qu-y committed Dec 5, 2024
1 parent 38c7d22 commit cc9ac87
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/views/Papers/Research/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1171,6 +1171,26 @@ new Vue({
if (content[0]["title"] != false) {
document.title = content[0]["title"];
}

//set page description
if (content[0]["description"] != false) {
let metaDesc = document.querySelector(
'meta[name="description"]'
);
if (metaDesc) {
metaDesc.setAttribute(
"content",
content[0]["description"]
);
} else {
let meta = document.createElement("meta");
meta.name = "description";
meta.content = content[0]["description"];
document
.getElementsByTagName("head")[0]
.appendChild(meta);
}
}
}
},

Expand Down

0 comments on commit cc9ac87

Please sign in to comment.