Ghost/core/server/utils
Aileen Nowak e19e91044d 🙇 Blog icon utils and publisher.logo for JSON-LD (#8297)
refs #8221, closes #7688, refs #7558

🙇  Improve meta data publisher logo behaviour
This is a follow-up PR for #8285.

Reasons: The code changes of #8285 caused error messages when falling back to the default `favicon.ico`, as the `image-size` tool doesn't support `ico` files.

This PR takes the logic to decide which logo needs to be listed in our schema into a new fn `blog_logo.js`. There we have now three decisions:
1. If we have a publication **logo**, we'll take that one
2. If we have no publication logo, but an **icon** we'll use this one.
3. If we have none of the above things, we fall back to our default `favicon.ico`

Additional, we're hard coding image dimensions for whenever the logo is an `.ico` file and built and extra decision to not call `image-size` when the dimension are already given.

I will create another follow-up PR, which checks the extension type for the file and offers it as a util.

🛠  Blog icon util

refs #7688

Serve functionality around the blog icon in its own util:
- getIconDimensions -> async function that takes the filepath of on ico file and returns its dimensions
- isIcoImageType -> returns true if file has `.ico` extension
- getIconType -> returns icon-type (`x-icon` or `png`)
- getIconUrl -> returns the absolut or relativ URL for the favicon: `[subdirectory or not]favicon.[ico or png]`

📖  Get .ico sizes for meta data & logo improvement

refs #7558
refs #8221

Use the new `blogIconUtil` in meta data to fetch the dimensions of `.ico` files.

Improvements for `publisher.logo`: We're now returning a hard-coded 'faked' image dimensions value to render an `imageObject` and prevent error our schema (Google structured data). As soon as an image (`.ico` or non-`.ico`) is too large, but - in case of non-`.ico` - a square format, be set the image-dimensions to 60px width and height. This reduces the chances of getting constantly error messages from Googles' webmaster tools.

- add getIconPath util
2017-04-11 18:32:06 +02:00
..
packages 🎨 Collect & simplify package utils (#8080) 2017-03-01 14:09:31 +01:00
asset-hash.js 🐛 Refresh assetHash on theme override (#7430) 2016-09-23 13:05:44 +02:00
blog-icon.js 🙇 Blog icon utils and publisher.logo for JSON-LD (#8297) 2017-04-11 18:32:06 +02:00
cached-image-size-from-url.js 🐛 fix image size timeout (#8283) 2017-04-05 21:58:26 +01:00
ghost-version.js Misc Middleware cleanup (#7526) 2016-10-10 21:14:32 +02:00
gravatar.js 🎨 😎 config env usages (#7929) 2017-02-03 18:25:39 +00:00
image-size-from-url.js 🐛 fix image size timeout (#8283) 2017-04-05 21:58:26 +01:00
index.js Removed ghost editor dependency (#8137) 2017-03-14 18:07:33 +00:00
labs.js Helper Proxy & single express-hbs instance (#8225) 2017-04-04 18:07:35 +02:00
make-absolute-urls.js 🎨 source out url utils from ConfigManager (#7347) 2016-09-20 15:59:34 +01:00
mobiledoc-converter.js 📦 Card-Rename (#8218) 2017-03-24 10:03:33 +00:00
pipeline.js Pipeline util tests, clean & fix 2015-11-03 09:14:44 +00:00
read-csv.js Add CSV parser for csv read utility 2016-06-07 10:47:56 +01:00
remove-open-redirect-from-url.js Remove open redirect by removing double slashes from redirects (#7247) 2016-08-23 13:47:59 +02:00
sequence.js post-scheduling 2016-06-14 10:52:13 +02:00
social-urls.js Add helpers for facebook & twitter urls 2016-05-17 16:39:58 +01:00
tokens.js 🎨 remove token logic from user model (#7622) 2016-11-07 11:18:50 +00:00
url.js 🎨 Move settings cache & cleanup settings API (#8057) 2017-02-27 16:53:04 +01:00
visibility.js Helper Proxy & single express-hbs instance (#8225) 2017-04-04 18:07:35 +02:00
zip-folder.js 🎨 Ghost bootstrap: optimise requires (#8121) 2017-03-13 20:07:12 +00:00