Skip to content

Commit

Permalink
Merge pull request #222 from jshemas/june-2
Browse files Browse the repository at this point in the history
adding a new favicon fallback using appIcon
  • Loading branch information
jshemas authored Jun 3, 2024
2 parents e719dd0 + de0e3b8 commit e0746b0
Show file tree
Hide file tree
Showing 6 changed files with 321 additions and 310 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

## 6.5.2

- adding a new favicon fallback using appIcon
- Updating dependencies to fix npm vulnerabilities

## 6.5.1

- jsonLD is now a array of objects since there can be more then one jsonLD tag pre page
Expand Down
3 changes: 3 additions & 0 deletions dist/lib/fallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ function fallback(ogObject, options, $, body) {
else if (doesElementExist('link[type="image/x-icon"]', 'href', $)) {
ogObject.favicon = $('link[type="image/x-icon"]').attr('href');
}
else if (doesElementExist('head > meta[property*="appIcon"]', 'content', $)) {
ogObject.favicon = $('head > meta[property*="appIcon"]').attr('content');
}
}
// set the charset
if (doesElementExist('meta', 'charset', $)) {
Expand Down
2 changes: 2 additions & 0 deletions lib/fallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ export function fallback(ogObject: OgObjectInteral, options: OpenGraphScraperOpt
ogObject.favicon = $('link[type="image/ico"]').attr('href');
} else if (doesElementExist('link[type="image/x-icon"]', 'href', $)) {
ogObject.favicon = $('link[type="image/x-icon"]').attr('href');
} else if (doesElementExist('head > meta[property*="appIcon"]', 'content', $)) {
ogObject.favicon = $('head > meta[property*="appIcon"]').attr('content');
}
}

Expand Down
Loading

0 comments on commit e0746b0

Please sign in to comment.