Skip to content

Commit

Permalink
fix: ignore meta tags with no content
Browse files Browse the repository at this point in the history
  • Loading branch information
martip committed Feb 10, 2021
1 parent 300627d commit 7482693
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -250,9 +250,9 @@ function getMetadata (ctx, opts: Opts) {
let pair

if (tagname === 'meta') {
if (attribs.name === 'description') {
if (attribs.name === 'description' && attribs.content) {
pair = ['description', attribs.content]
} else if (attribs.name === 'keywords') {
} else if (attribs.name === 'keywords' && attribs.content) {
let keywords = attribs.content
.replace(/^[,\s]{1,}|[,\s]{1,}$/g, '') // gets rid of trailing space or sommas
.split(/,{1,}\s{0,}/) // splits on 1+ commas followed by 0+ spaces
Expand Down

0 comments on commit 7482693

Please sign in to comment.