Download the PHP package sergeybruhin/page-meta without Composer
On this page you can find all versions of the php package sergeybruhin/page-meta. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sergeybruhin/page-meta
More information about sergeybruhin/page-meta
Files in sergeybruhin/page-meta
Package page-meta
Short Description Laravel Page Meta Package
License MIT
Homepage https://github.com/sergeybruhin/page-meta
Informations about the package page-meta
Laravel Page Meta Package
Basic and simple package to help you generate page meta inside your blade layout.
Installation
You can install the package via composer:
Head Meta
Generates standard HTML <head> meta tags: title, description, author, keywords, robots directives, and canonical URL.
Controller
Render
Template renders when $headMeta is set in the view.
Output
Available methods
| Method | Description |
|---|---|
setTitle(string, ?string $separator) |
Page title. Pass a separator (e.g. ' \| ') to append globalSiteName from config. |
setDescription(string) |
Meta description. |
setAuthor(string) |
Meta author. |
setCanonical(string) |
Canonical URL. Only rendered when set. |
setKeywords(string\|array) |
Meta keywords. |
setRobots(string) |
Raw robots string, e.g. 'noindex, nofollow'. |
noIndex() |
Adds noindex to robots. |
noFollow() |
Adds nofollow to robots. |
noArchive() |
Adds noarchive to robots. |
noSnippet() |
Adds nosnippet to robots. |
Configuration
Publish the config to set your site name:
Open Graph
Controller
Render
Template renders when $openGraph is set in the view.
Schema.org (JSON-LD)
Unlike Head Meta / Open Graph / Twitter (which render tag-by-tag from a Blade
partial), Schema.org nodes are plain data objects that serialize to a nested
array via toArray()/JsonSerializable, then get JSON-encoded once as a
single <script type="application/ld+json"> tag.
Controller
schemaGraph() always wraps its nodes in a single {"@context": "https://schema.org", "@graph": [...]} document — even for a single node — so there's one entry point regardless of how many nodes a page needs.
Render
Template renders when $schema is set in the view.
Available types
| Factory | Type | Notes |
|---|---|---|
PageMeta::schemaOrganization(name, url, type = 'Organization') |
Organization |
Pass Organization::TYPE_LOCAL_BUSINESS for a LocalBusiness-flavored node. |
PageMeta::schemaWebsite(name, url) |
WebSite |
setPublisher(Organization). |
PageMeta::schemaArticle(headline) |
Article |
setImage, setDatePublished/setDateModified, setAuthor(Person), setPublisher(Organization), addKeywords. |
PageMeta::schemaBreadcrumbList(array $breadcrumbs = []) |
BreadcrumbList |
Accepts [['url' => .., 'name' => ..], ...] directly. |
Value objects live under Meta\Schema\Partials: PostalAddress, ImageObject, Person, ListItem.
Every property is stripped from the output when null/empty, so it's safe to
build a node from partially-available data.
Testing (Not yet 💁♂️)
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Sergey Bruhin
- All Contributors
License
The MIT License (MIT). Please see License File for more information.