Skip to content

Commit

Permalink
Statamic v4 update (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
martink635 authored May 10, 2023
1 parent 1504a5f commit 9e7f4e4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Seotamic - Statamic SEO Addon

Statamic v3.3+ only. Automatically adds a SEO tab to all your collection entries where you can fine tune SEO for every entry. Works perfectly with Antlers, Blade and in headless mode (PRO edition) with the Statamic REST API or GraphQL integration out of the box.
Statamic v4.0+ only. For Statamic v3 Support use the 3.0.\* releases. Automatically adds a SEO tab to all your collection entries where you can fine tune SEO for every entry. Works perfectly with Antlers, Blade and in headless mode (PRO edition) with the Statamic REST API or GraphQL integration out of the box.

## Quick Antlers usage sample

Expand All @@ -24,6 +24,10 @@ Generates the whole array of SEO settings:
...
```

# Version 4 changes

Statamic v4 compatibility. Some internal functions were changed due to how blueprints work in Statamic v4. This release breaks compatibility with Statamic v3. Upgrade to Statamic v4 before upgrading to this version. Upgrade path from SEOtamic v2 is still the same.

# Version 3 changes

Version 3 has breaking changes. If you update from version 1 or 2, your global settings will not be transfered. The data layout is a bit different and so is the data on specific entries.
Expand All @@ -48,7 +52,7 @@ Include the package with composer:
composer require cnj/seotamic
```

The package requires Laravel 9+ and PHP 8.0+. It will auto register.
The package requires Laravel 9+ and PHP 8.1+. It will auto register.

The SEO & Social section tab will appear on all collection entries automatically.

Expand All @@ -70,7 +74,7 @@ Usage is fairly simple and straight forward. You can visit the global Settings b

![Meta preview](./resources/screenshots/meta_preview.png)

After this you can fine tune the output of each collection entry by editing the SEO settings under the entry's SEO tab. In version 3 you can also preview the output of the meta and social settings. The previews should give an accurate representation of the output.
After this you can fine tune the output of each collection entry by editing the SEO settings under the entry's SEO tab. From version 3 you can also preview the output of the meta and social settings. The previews should give an accurate representation of the output.

![Social preview](./resources/screenshots/social_preview.png)

Expand Down Expand Up @@ -177,9 +181,9 @@ inject:
This package was built by [CNJ Digital](https://www.cnj.si/).
# Version 3 License
# Version 3 and 4 License
Version 3 is a commercial addon for Statamic. It is open source but not free to use. You can purchase a license at [Statamic Marketplace](https://statamic.com/marketplace/addons/seotamic).
Version 3 and 4 are a commercial addon for Statamic. It is open source but not free to use. You can purchase a license at [Statamic Marketplace](https://statamic.com/marketplace/addons/seotamic).
# Version 2 and 1 License
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "cnj/seotamic",
"description": "Simple SEO addon for Statamic v3",
"description": "Simple SEO addon for Statamic",
"type": "statamic-addon",
"license": "proprietary",
"require": {
"php": "^8.0",
"statamic/cms": "^3.3.0"
"php": "^8.1",
"statamic/cms": "^4.0.0"
},
"require-dev": {
"orchestra/testbench": "^7.0",
Expand All @@ -30,7 +30,7 @@
"extra": {
"statamic": {
"name": "Seotamic",
"description": "Simple SEO addon for Statamic v3",
"description": "Simple SEO addon for Statamic",
"editions": [
"lite",
"pro"
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private function setLocale()

protected function formBlueprint()
{
return Blueprint::makeFromSections([
return Blueprint::makeFromTabs([
'name' => [
'display' => __('seotamic::general.title_title'),
'fields' => [
Expand Down
4 changes: 2 additions & 2 deletions src/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public function addFields($event)
}

// This should not be translated, so we can target them
$this->blueprint->ensureFieldsInSection($this->getMetaFields(), 'SEO');
$this->blueprint->ensureFieldsInSection($this->getSocialFields(), 'Social');
$this->blueprint->ensureFieldsInTab($this->getMetaFields(), 'SEO');
$this->blueprint->ensureFieldsInTab($this->getSocialFields(), 'Social');
}

/**
Expand Down
6 changes: 4 additions & 2 deletions src/routes/cp.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

use Cnj\Seotamic\Http\Controllers\SettingsController;

Route::middleware('statamic.cp.authenticated')->group(function () {
Route::get('/cnj/seotamic/', 'SettingsController@index')->name('cnj.seotamic.index');
Route::post('/cnj/seotamic/', 'SettingsController@update')->name('cnj.seotamic.update');
Route::get('/cnj/seotamic/', [SettingsController::class, 'index'])->name('cnj.seotamic.index');
Route::post('/cnj/seotamic/', [SettingsController::class, 'update'])->name('cnj.seotamic.update');
});
2 changes: 2 additions & 0 deletions src/routes/web.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php

use Cnj\Seotamic\Http\Controllers\SitemapController;

Route::get('sitemap.xml', SitemapController::class)->name('cnj.seotamic.sitemap');

0 comments on commit 9e7f4e4

Please sign in to comment.