community-forum icon indicating copy to clipboard operation
community-forum copied to clipboard

[Feature Request] favicon setting

Open guleswine opened this issue 3 years ago • 6 comments
trafficstars

Feature Request

What's the feature you think Backpack should have?

Set custom favicon for admin panel

Have you already implemented a prototype solution, for your own project?

We can to override vendor/backpack/crud/src/resources/views/base/inc/head.blade.php and add something like <link rel="icon" href="{{ url('uploads/site/icon.png') }}"> but it seems to me that for such simple things overriding is a bad option

maybe I'm wrong and it's already configured somehow easier?

guleswine avatar Apr 17 '22 08:04 guleswine

I would also like that! Good idea @guleswine . I think a quick way to do this would be to create a new file in the head, which gets loaded if it exists. You'd then be able to push whatever you want inside the HEAD - not only metas, but also CSS, JS, whatever.

Wait... we can already do that, can't we? We can create a resources/views/vendor/backpack/base/inc/head.blade.php that would include:


<link rel="icon" href="{{ url('uploads/site/icon.png') }}">

@include('backpack::inc.head')

That should do it too, right @guleswine ?

tabacitu avatar Apr 18 '22 07:04 tabacitu

What I would personally like is to have the Backpack logo (the new one, coming soon, not the current old one) as the logo for the admin panel. But I don't know how many people would be ok with that... The idea behind that is for admins to be able to save the admin panel on their iOS / Android devices as apps, in which case the favicon would be important. It would also be useful on the desktop, for the admin to know if they're on a front-end page... or the admin panel...

But again... that would basically involved pushing the Backpack branding onto the admin panel, so it would require one more step (to remove that branding) in order to make it white-label. Don't know how many devs would prefer separate admin panel branding, and how many would prefer to use their own branding...

tabacitu avatar Apr 18 '22 07:04 tabacitu

Wait... we can already do that, can't we? We can create a resources/views/vendor/backpack/base/inc/head.blade.php that would include:

@tabacitu , no, I think you can not do it that way. When the system will try to resolve 'backpack::inc.head' it will resolve to the overwritten file under resources/views/vendor/backpack/base/inc/head.blade.php and then cash this template to the path. Once you try to include template @include('backpack::inc.head') it will be resolver to the resources/views/vendor/backpack/base/inc/head.blade.php again and as a result, you will get a recursion.

Is there a better way?

mialex avatar Apr 18 '22 16:04 mialex

Maybe include the file directly without using the view namespace so it doesn't get resolved by Laravel container?

pxpm avatar Apr 19 '22 08:04 pxpm

Wait... we can already do that, can't we? We can create a resources/views/vendor/backpack/base/inc/head.blade.php that would include:

its sounds like true, but i try @include('backpack::inc.head') or @extends(backpack_view('inc.head')) and recive 500 error

probably @mialex was right

@tabacitu , no, I think you can not do it that way. When the system will try to resolve 'backpack::inc.head' it will resolve to the overwritten file under resources/views/vendor/backpack/base/inc/head.blade.php and then cash this template to the path. Once you try to include template @include('backpack::inc.head') it will be resolver to the resources/views/vendor/backpack/base/inc/head.blade.php again and as a result, you will get a recursion.

Don't know how many devs would prefer separate admin panel branding, and how many would prefer to use their own branding...

what about that, i think every site should have own brand, but even if I discard my preferences, in browser - two open tabs of different panels based on the backpack will merge icons ;)

guleswine avatar Apr 19 '22 18:04 guleswine

Hello, @tabacitu for my working but I put on vendor->crud->src->resources->views->inc->head.blade.php

Devotom avatar Dec 03 '22 04:12 Devotom

We now have a meta/favicon generator. You just need to replace the images with your own: https://backpackforlaravel.com/docs/6.x/base-how-to#publish-mobile-and-favicon-headers-and-assets-1

Cheers

pxpm avatar Sep 19 '24 14:09 pxpm