Site Essentials for Statamic

Site Essentials for Statamic

Front-end Templates

There are two ways to add favicon metadata/link tags to your site's front-end templates: the dedicated Antlers tag and the metadata provider.

#Using the Antlers Tag

The se_get_favicons Antlers tag returns information about the generated favicons to help construct the final meta/link tags.

The se_get_favicons tag will return an array of all favicons that have been successfully generated, including the following information:

  • rel: The configured rel value.

  • format: The generated favicon's mime type.

  • sizes: A string representing the size of the generated favicon.

  • href: The relative public path to the generated favicon.

1{{ se_get_favicons }}
2 <link
3 rel="{{ rel }}"
4 type="{{ type }}"
5 sizes="{{ sizes }}"
6 href="{{ href }}"
7 >
8{{ /se_get_favicons }}

#Using Metadata Providers

If you are already using the {{ se_meta /}} tag, the easiest way to inject generated favicons into your site's front-end template is to register the Site Essentials for Statamic metadata provider:

3namespace App\Providers;
5use Illuminate\Support\ServiceProvider;
6use Stillat\StatamicSiteEssentials\Support\Facades\Metadata;
8class AppServiceProvider extends ServiceProvider
10 /**
11 * Bootstrap any application services.
12 */
13 public function boot(): void
14 {
15 // ...
17 Metadata::withDefaults()->addProviders([
18 \Stillat\StatamicSiteEssentials\Metadata\EssentialMetadataProvider::class,
19 ]);
21 // ...
22 }

Some absolutely amazing

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.