Skip to content

adding a new favicon fallback using appIcon #222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading