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

Add favicon to proprietor page #992

Merged
merged 1 commit into from
Mar 11, 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
13 changes: 11 additions & 2 deletions app/helpers/hyrax_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@ def banner_image
Site.instance.banner_image? ? Site.instance.banner_image.url : super
end

def favicon
Site.instance.favicon? ? Site.instance.favicon.url : super
def favicon(size)
icon = Site.instance.favicon
if icon
case icon
when FaviconUploader
return Site.instance.favicon.url(size)
when String
return Site.instance.favicon
end
end
nil
end

def logo_image
Expand Down
4 changes: 2 additions & 2 deletions app/models/nil_site.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ def admin_emails=(value)
value
end

def favicon?
false
def favicon
"favicon.png"
end

def banner_image?
Expand Down
25 changes: 13 additions & 12 deletions app/views/_head_tag_extras.html.erb
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<%= render_gtm_head(request.original_url) %>

<!-- generics -->
<link rel="icon" href="<%= Site&.favicon&.url(:v32) %>" sizes="32x32">
<link rel="icon" href="<%= Site&.favicon&.url(:v57) %>" sizes="57x57">
<link rel="icon" href="<%= Site&.favicon&.url(:v76) %>" sizes="76x76">
<link rel="icon" href="<%= Site&.favicon&.url(:v96) %>" sizes="96x96">
<link rel="icon" href="<%= Site&.favicon&.url(:v128) %>" sizes="128x128">
<link rel="icon" href="<%= Site&.favicon&.url(:v128) %>" sizes="192x192">
<link rel="icon" href="<%= Site&.favicon&.url(:v228) %>" sizes="228x228">
<link rel="icon" href="<%= favicon(:v32) %>" sizes="32x32">
<link rel="icon" href="<%= favicon(:v57) %>" sizes="57x57">
<link rel="icon" href="<%= favicon(:v76) %>" sizes="76x76">
<link rel="icon" href="<%= favicon(:v96) %>" sizes="96x96">
<link rel="icon" href="<%= favicon(:v128) %>" sizes="128x128">
<link rel="icon" href="<%= favicon(:v128) %>" sizes="192x192">
<link rel="icon" href="<%= favicon(:v228) %>" sizes="228x228">

<!-- Android -->
<link rel="shortcut icon" href="<%= Site&.favicon&.url(:v196) %>" sizes="196x196">
<link rel="shortcut icon" href="<%= favicon(:v196) %>" sizes="196x196">

<!-- iOS -->
<link rel="apple-touch-icon" href="<%= Site&.favicon&.url(:v120) %>" sizes="120x120">
<link rel="apple-touch-icon" href="<%= Site&.favicon&.url(:v152) %>" sizes="152x152">
<link rel="apple-touch-icon" href="<%= Site&.favicon&.url(:v180) %>" sizes="180x180">
<link rel="apple-touch-icon" href="<%= favicon(:v120) %>" sizes="120x120">
<link rel="apple-touch-icon" href="<%= favicon(:v152) %>" sizes="152x152">
<link rel="apple-touch-icon" href="<%= favicon(:v180) %>" sizes="180x180">

<!-- Windows 8 IE 10-->
<meta name="msapplication-TileColor" content="#FFFFFF">
<meta name="msapplication-TileImage" content="<%= Site&.favicon&.url(:v228)">
<meta name="msapplication-TileImage" content="<%= favicon(:v228) %>">

<!— Windows 8.1 + IE11 and above —>
<meta name="msapplication-config" content="/browserconfig.xml" />
Binary file added public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading