{"id":13606496,"url":"https://github.com/wintercms/wn-seo-plugin","last_synced_at":"2026-04-01T22:53:34.157Z","repository":{"id":56853231,"uuid":"524591073","full_name":"wintercms/wn-seo-plugin","owner":"wintercms","description":"Plugin for managing SEO metadata in Winter CMS","archived":false,"fork":false,"pushed_at":"2024-10-14T07:29:19.000Z","size":61,"stargazers_count":9,"open_issues_count":5,"forks_count":5,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-06T23:26:27.056Z","etag":null,"topics":["hacktoberfest","plugin","seo","wintercms"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wintercms.png","metadata":{"funding":{"github":"wintercms","open_collective":"wintercms"},"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-14T06:26:25.000Z","updated_at":"2024-10-17T11:17:59.000Z","dependencies_parsed_at":"2024-04-11T05:27:10.121Z","dependency_job_id":"6d944416-3d7d-4268-bc88-1e128b6d5a93","html_url":"https://github.com/wintercms/wn-seo-plugin","commit_stats":{"total_commits":21,"total_committers":5,"mean_commits":4.2,"dds":"0.38095238095238093","last_synced_commit":"0cc231de0634076274794b69fcae30a2450c6dc0"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercms%2Fwn-seo-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercms%2Fwn-seo-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercms%2Fwn-seo-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wintercms%2Fwn-seo-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wintercms","download_url":"https://codeload.github.com/wintercms/wn-seo-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253541813,"owners_count":21924723,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","plugin","seo","wintercms"],"created_at":"2024-08-01T19:01:09.682Z","updated_at":"2026-04-01T22:53:34.086Z","avatar_url":"https://github.com/wintercms.png","language":"PHP","funding_links":["https://github.com/sponsors/wintercms","https://opencollective.com/wintercms"],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# SEO Plugin\n\nEasily handle Search Engine Optimization in your Winter CMS projects. Inspired by https://github.com/bennothommo/wn-meta-plugin.\n\nFuture plans including support for easily generating structured data and automatically attaching SEO meta fields to CMS pages, Winter.Pages pages, \u0026 generically to any Winter CMS model. Check the TODO list in Plugin.php for more planned features.\n\n## Installation\n\n```bash\ncomposer require winter/wn-seo-plugin\n```\n\nThen add the `[seoTags]` component to your `\u003chead\u003e` in your theme, ideally right after the standard encoding and responsiveness tags.\n\n### Suggested implementation:\n\n**Layout or header partial**: \n```twig\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n    \u003chead\u003e\n        \u003cmeta charset=\"UTF-8\"\u003e\n        \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n        \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u003e\n        {% partial \"meta/seo\" %}\n    \u003c/head\u003e\n```\n\n**`partials/meta/seo.htm`:**\n```twig\n[seoTags]\n==\n\u003c?php\nuse Backend\\Models\\BrandSetting;\nuse System\\Classes\\MediaLibrary;\nuse Winter\\SEO\\Classes\\Link;\nuse Winter\\SEO\\Classes\\Meta;\nfunction onStart()\n{\n    $this['page_title'] = $this-\u003epage-\u003etitle ?? Meta::get('og:title') ?? '';\n    $this['app_name'] = BrandSetting::get('app_name');\n\n    // Set the cannonical URL\n    Link::set('canonical', \\URL::current());\n\n    // Parse the meta_image as a media library image\n    if (!empty($this-\u003epage-\u003emeta_image)) {\n        $this-\u003epage-\u003emeta_image = MediaLibrary::url($this-\u003epage-\u003emeta_image);\n    }\n\n    // Handle the nofollow meta property being set\n    if (!empty($this-\u003epage-\u003emeta_nofollow)) {\n        Link::set('robots', 'nofollow');\n    }\n\n    // Set the meta tags based on the current page if not set\n    $metaMap = [\n        Meta::class =\u003e [\n            'og:title' =\u003e 'meta_title',\n            'og:description' =\u003e 'meta_description',\n            'og:image' =\u003e 'meta_image',\n        ],\n        Link::class =\u003e [\n            'prev' =\u003e 'paginatePrev',\n            'next' =\u003e 'paginateNext',\n        ],\n    ];\n    foreach ($metaMap as $class =\u003e $map) {\n        foreach ($map as $name =\u003e $pageProp) {\n            if (!empty($this-\u003epage-\u003e{$pageProp}) \u0026\u0026 empty($class::get($name))) {\n                $class::set($name, $this-\u003epage-\u003e{$pageProp});\n            }\n        }\n    }\n\n    $this['raw_title'] = Meta::get('title');\n}\n?\u003e\n==\n\u003ctitle\u003e\n    {%- placeholder page_title default %}\n        {%- if raw_title %}{{ raw_title | striptags }}{% elseif page_title %}{{ page_title | striptags }} | {{ app_name }}{% else %}{{ app_name }}{% endif -%}\n    {% endplaceholder -%}\n\u003c/title\u003e\n{% component seoTags %}\n```\n\n## Configuration\n\nConfiguration for this plugin is handled through a [configuration file](https://wintercms.com/docs/plugin/settings#file-configuration). In order to modify the configuration values and get started you can copy the `plugins/winter/seo/config/config.php` file to `config/winter/seo/config.php` and make your changes there.\n\n## Usage\n\n### Meta Tags\n\nUse the `Meta` class to add `\u003cmeta\u003e` tags that will be rendered by the `[seoTags]` component. Examples:\n\n```php\nuse Winter\\SEO\\Classes\\Meta;\n\n// Adds \u003cmeta name=\"og:type\" content=\"article\"\u003e\nMeta::set('og:type', 'article');\n\n// Appends a meta tag to the collection; allowing for full control of the\n// attributes used as well as preventing it from being overridden and / or\n// enabling multiple tags with the same name to be added.\nMeta::append([\n    'name' =\u003e 'og:type',\n    'content' =\u003e 'article',\n    'example_attribute' =\u003e 'the_cake_is_a_lie',\n]);\n\n// Overrides `og:type` because it was set later in the request\nMeta::set('og:type', 'article');\n\n// Retreive a specific meta tag by its name\nMeta::get('og:type');\n\n// Retrieve all meta tags currently set in this request\nMeta::all()\n\n// Clear all previously set meta tags and start fresh from this point on in the request\nMeta::refresh();\n```\n\n### Link Tags\n\nUse the `Link` class to add `\u003clink\u003e` tags that will be rendered by the `[seoTags]` component. Examples:\n\n```php\nuse Winter\\SEO\\Classes\\Link;\n\n// Adds \u003clink rel=\"base_url\" rel=\"https://example.com\"\u003e\nLink::set('base_url', 'https://example.com');\n\n// Appends a link tag to the collection; allowing for full control of the\n// attributes used as well as preventing it from being overridden and / or\n// enabling multiple tags with the same name to be added.\nLink::append([\n    'rel' =\u003e 'preload',\n    'href' =\u003e 'https://example.com/logo.png',\n    'as' =\u003e 'image',\n]);\n\n// Overrides `base_url` because it was set later in the request\nLink::set('base_url', url()-\u003ecurrent());\n\n// Retreive a specific link tag by its name\nLink::get('base_url');\n\n// Retrieve all link tags currently set in this request\nLink::all()\n\n// Clear all previously set link tags and start fresh from this point on in the request\nLink::refresh();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintercms%2Fwn-seo-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwintercms%2Fwn-seo-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwintercms%2Fwn-seo-plugin/lists"}