til/content/posts/favicons.md

22 lines
1.0 KiB
Markdown
Raw Normal View History

2020-11-10 09:57:34 +00:00
---
2020-11-10 11:01:31 +00:00
title: "How to get the favicon of any site"
date: 2020-11-10T09:49:37+01:00
2020-11-10 09:57:34 +00:00
draft: false
tags:
2021-05-11 18:40:15 +00:00
-
2020-11-10 09:57:34 +00:00
images:
2021-05-11 18:40:15 +00:00
- https://opengraph.cluster.fun/opengraph/?siteTitle=Today%20I%20learnt...&title=How%20to%20get%20the%20favicon%20of%20any%20site&tags=favicon&image=https%3A%2F%2Fmarcusnoble.co.uk%2Fimages%2Fmarcus.jpg&twitter=Marcus_Noble_&github=AverageMarcus&website=www.MarcusNoble.co.uk
2020-11-10 09:57:34 +00:00
---
If you ever find yourself needing to display a small icon for a 3rd party URL but don't want to have to crawl the site to pull out the favicon URL then you can make use of a Google CDN:
```
https://s2.googleusercontent.com/s2/favicons?domain_url=https://www.bbc.co.uk/
```
Example: ![](https://s2.googleusercontent.com/s2/favicons?domain_url=https://www.bbc.co.uk/)
2020-11-10 09:59:50 +00:00
You can even provide any page, not just the root URL.
e.g. `https://s2.googleusercontent.com/s2/favicons?domain_url=https://www.bbc.co.uk/news/newsbeat-54838856`: ![](https://s2.googleusercontent.com/s2/favicons?domain_url=https://www.bbc.co.uk/news/newsbeat-54838856)