Skip to content
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

Adds favicon to generated docs. #3832

Closed
wants to merge 1 commit into from

Conversation

philnash
Copy link
Contributor

@philnash philnash commented Jan 4, 2017

When I have a bunch of tabs open and I am trying to find docs pages it is hard
because there is no visible favicon.

This commit adds elements to the of the two docs HTML templates.
It uses the the main site favicon which, when generated and hosted at
crystal-lang.org, is located at the absolute path /images/favico.{ico,png}.

When I have a bunch of tabs open and I am trying to find docs pages it is hard
because there is no visible favicon.

This commit adds <link> elements to the <head> of the two docs HTML templates.
It uses the the main site favicon which, when generated and hosted at
crystal-lang.org, is located at the absolute path /images/favicon.{ico,png}.
@makenowjust
Copy link
Contributor

👎 This fix depends crystal-lang.org structure too deeply. And, we can specify a favicon when place a favicon into /favicon.ico.

@bcardiff
Copy link
Member

bcardiff commented Jan 4, 2017

Same as @makenowjust . An alternative solution would be to allow some partial/include when building docs. This could allow custom favicons on build and some js lines to for example show a banner when visiting non-latest versions of the documentation (this last inspired by elm documentation).

@philnash
Copy link
Contributor Author

philnash commented Jan 4, 2017

Thanks for the reviews! I think you're right @makenowjust, I did this in the wrong place. Moving the crystal-website favicons to the default place for the domain would not only solve this for the latest documentation, but all pages that have already been generated.

@bcardiff while your suggestion is way out of scope for this little pull request, I'd like to see that banner on non-latest versions too.

@philnash philnash closed this Jan 4, 2017
philnash added a commit to philnash/crystal-website that referenced this pull request Jan 4, 2017
This has two benefits:

* The docs will automatically pick up the favicon without any work ([see
discussion](crystal-lang/crystal#3832)).
* Less clutter in the `<head>`
spalladino pushed a commit to crystal-lang/crystal-website that referenced this pull request Jan 5, 2017
* Moves favicon files to root of site.

This has two benefits:

* The docs will automatically pick up the favicon without any work ([see
discussion](crystal-lang/crystal#3832)).
* Less clutter in the `<head>`

* Adds link tag back to <head> for PNG favicon.

Chrome and Safari will pick the .ico if there are links to both [according to this blog post](http://www.jonathantneal.com/blog/understand-the-favicon/).

The recommended approach from the blog post if you want to serve PNG favicons to browsers that support them is to just have a `<link>` for the PNG favicon. This will get ignored by browsers that don't support PNGs (IE10 and below) and they will then load the default `/favicon.ico`.

This way we can have PNGs in Chrome and Safari and ICO for fallbacks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants