Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Statamic Google Fonts Laravel Package

mitydigital/statamic-google-fonts

A Statamic addon for managing Google Fonts: configure font families and weights, download and self-host files locally, and generate the CSS you need—avoiding external Google requests for better privacy and performance.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the addon: composer require mitydigital/statamic-google-fonts. Statamic's addon discovery registers the service provider automatically; only add it manually if you've disabled discovery.
  2. Publish the config so you can tune caching and defaults: php artisan vendor:publish --provider="MityDigital\StatamicGoogleFonts\ServiceProvider" (or pick the package's tag from the vendor:publish menu).
  3. Look first at config/statamic-google-fonts.php and at the Google Fonts utility in the Statamic CP (under Tools or Content, depending on your Statamic version). The utility is where editors pick families, weights, styles and subsets.
  4. First use case: in the utility add a family (e.g. Inter), tick the weights you need (400/600/700), save, then drop the tag into your layout <head>:
{{ google_fonts }}

That renders the <link rel="preconnect"> and stylesheet <link> tags for every configured family. Put it once in your base layout (resources/views/layout.antlers.html or your Blade layout) before your own CSS so the cascade order is correct.

Implementation Patterns

  • Base layout only. The tag is cheap, but it emits the full set of links — keep it in the layout rather than in per-page partials.
  • Blade sites. Use {!! Statamic::tag('google_fonts') !!} (or the package's Blade directive/component, if provided — check the README). The tag returns HTML, so it must be rendered unescaped.
  • Granular control. If you need to build the <link> yourself (media queries, onload swapping), check src/Tags/ for a URL-only handle such as {{ google_fonts:url }} before hand-rolling the output.
  • Config vs CP. Editor-managed fonts belong in the CP utility; environment-specific values (different font sets locally vs production) belong in config/statamic-google-fonts.php behind env() guards.
  • Cache the catalogue. The CP picker pulls the whole Google Fonts catalogue. Set a sensible cache TTL in config so the CP doesn't call Google on every load, and clear it when you need newly released families.
  • Performance. Preconnect hints are emitted for you — if you self-host or proxy fonts, turn them off and keep only the stylesheet link. Trim subsets to the scripts you actually use (latin, latin-ext, …) to avoid a bloated CSS payload.
  • Override the markup. Publish the package views and edit the tag template if you need media queries, font-display tweaks, or async loading patterns.

Gotchas and Tips

  • 2.1.3 (patch, non-breaking): "Tweak URL behaviour if on the same host." If you proxy or self-host fonts on your own domain, re-check the emitted URLs after upgrading — that's the code path that changed. Nothing to do for the standard Google CDN setup; no migration or config change required.
  • Antlers escaping. Don't pipe {{ google_fonts }} through a modifier (or use Blade's {{ }}) — the tag must render raw or you'll see escaped <link> markup.
  • View caching. In production, php artisan view:clear after changing configured families or weights, otherwise stale <link> tags can persist.
  • Catalogue cache. New Google families may not appear in the CP picker until the catalogue cache expires; php artisan cache:clear (or the package's own command) forces a refresh.
  • Weight/style matrix. Requesting a weight a family doesn't offer yields a broken or missing face — stick to what the picker exposes.
  • GDPR / privacy. The default is the Google CDN, which exposes visitor IPs to Google. For EU sites, self-host or proxy and adjust the URL/preconnect config — exactly the path 2.1.3 touches.
  • Debugging. If nothing renders, confirm the utility has saved settings and that the tag handle matches the one registered in src/Tags/. Dump the raw tag output to separate a config problem from a rendering problem.
  • Extension points. Published views for markup, the config file for caching/defaults, and any events the addon fires on settings changes.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle