Here's a quick and easy on how to add favicon.ico to a page using laravel.
1. Put your favicon.ico somewhere tidy
e.g. public/assets/img/
if your laravel app site is
/var/www/mywebsite/
put the favicon favincon.ico in the
/var/www/mywebsite/public/assets/img/
2. add the link code to your web page
Assuming you want the icon on every page
Link Code:
<link rel="shortcut icon" href="{{ asset('assets/img/favicon.ico') }}">
link code goes in the head section
edit resources/views/layout.blade.php
to access the head section
here's an example
<!doctype html>
<html lang="en">
@section('html-head')
<head>
<meta charset="UTF-8">
<title>{{ $pageName or 'MyWebsite' }}</title>
<link rel="shortcut icon" href="{{ asset('assets/img/favicon.ico') }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
@section('html-head-includes')
@if (App::environment() == 'local')
{!! HTML::style('/assets/lib/bootstrap/dist/css/bootstrap.css') !!}
{!! HTML::style('/assets/css/bootstrap-theme.css') !!}
@else
{!! HTML::style('/assets/lib/bootstrap/dist/css/bootstrap.min.css') !!}
{!! HTML::style('/assets/css/bootstrap-theme.css') !!}
@endif
{!! HTML::style('/assets/lib/font-awesome/css/font-awesome.min.css') !!}
{!! HTML::style('/assets/css/cityadmin.css') !!}
@show
</head>
@show
@section('html-body')
<body>
@yield("content")
</body>
@show
</html>
3. Test your websiteI find a new incognito window useful for testing new icon changes as nothing is previously cached.
Hope that you find this useful.
HOSTING A COMPLETE VIRTUAL SERVER FOR $5 A MONTH
Here's $10 credit to start your development server.
Claim 2 months free (value $10) now with virtual server host, digital ocean
If you found this post useful, consider supporting my music.
https://app.projektordigital.com/player/index.php?playlist=39&uid=7
No comments:
Post a Comment