<script>
(() => {
setTimeout(() => {
document.querySelectorAll("meta[name]").forEach(e => {
if (e.name == 'description' && e.content.trim() == "") {
e.content = document.querySelectorAll(".post-content")[0].innerText.replaceAll('\n', '').substring(0, 150) + "..."
}
console.warn(e.contains);
if (e.name == 'keywords' && e.content.trim() == "") {
e.content = "关键词"
}
})
if (document.title.trim() == "")
document.title = document.querySelectorAll('.display-1')[0].innerText
}, 200);
})()
</script>
标签:TDK,trim,name,querySelectorAll,生成,content,seo,document
From: https://www.cnblogs.com/lambertlt/p/17999485