Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/sitemap translate #86

Open
wants to merge 90 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
76e97b1
sitemap for images and videos
dzapek Jun 3, 2024
f4c33fa
add langs
dzapek Jun 4, 2024
cf6520f
add logick for sitemaps videos and images
dzapek Jun 5, 2024
d50c203
Merge branch 'develop' into feature/sitemap-translate
dzapek Jun 5, 2024
faa47c7
refactor
dzapek Jun 5, 2024
2e0c47f
sitemap with images and cideos ready
dzapek Jun 21, 2024
7b80206
cleanup
dzapek Jun 21, 2024
16eefbe
add model for media
dzapek Jul 4, 2024
4ff6998
sitemaps job works
dzapek Jul 19, 2024
a8f1b44
small translte fix
dzapek Jul 19, 2024
f539730
cleanup
dzapek Jul 22, 2024
2eab029
cleanup
dzapek Jul 23, 2024
8c71a99
Minor changes
tomaszstrojny Jul 24, 2024
bed7e5a
fix version
dzapek Jul 24, 2024
55a8730
Settings acting as expected
tomaszstrojny Jul 24, 2024
6599381
WIP
tomaszstrojny Jul 25, 2024
1c105ed
Generator cleaned up
tomaszstrojny Jul 25, 2024
15aa5b4
Generating pages should work
tomaszstrojny Jul 25, 2024
8811c2b
Typical errors fixed
tomaszstrojny Jul 25, 2024
785c66e
Clean settings up
tomaszstrojny Jul 26, 2024
fd4c754
DOMCreator introduced
tomaszstrojny Jul 26, 2024
aa5cb43
Separated pageItem from the model
tomaszstrojny Jul 26, 2024
c23b504
Cleaned typos and minor mistakes
tomaszstrojny Jul 26, 2024
8041680
Sitemap tested and working
tomaszstrojny Jul 26, 2024
858bb5f
In the middle of creating sitemap object representation
tomaszstrojny Jul 26, 2024
4c2b566
All sitemaps tested, just some polishes left
tomaszstrojny Jul 28, 2024
c16bb22
Tests work
tomaszstrojny Jul 28, 2024
4ee1063
Ready for testing
tomaszstrojny Jul 28, 2024
0692748
Initial SitemapIndex generator
tomaszstrojny Jul 28, 2024
5e94754
It's ready
tomaszstrojny Jul 29, 2024
8a7b2c9
Resolved conflict
tomaszstrojny Jul 30, 2024
8b29901
Self review
tomaszstrojny Jul 30, 2024
c874912
Add permissions
tomaszstrojny Aug 2, 2024
aa19a8c
Clean controllers
tomaszstrojny Aug 2, 2024
2b3db20
Update lang strings
tomaszstrojny Aug 2, 2024
5edf1c0
Fix breadcrumbs
tomaszstrojny Aug 2, 2024
dce64b7
Temporarly solution for requests, still work in progress
tomaszstrojny Aug 2, 2024
dd63c7f
Still pages to refresh
tomaszstrojny Aug 3, 2024
f73afad
Add basic rainlab.pages tests
tomaszstrojny Aug 3, 2024
ed8e1c7
Restoring if RainLab.Pages is enabled... No way it's happening
tomaszstrojny Aug 3, 2024
e65c70a
Cleaned up, it's once again ready for the review
tomaszstrojny Aug 3, 2024
80ccb2c
Fixed tests and regex for similar params keys
tomaszstrojny Aug 4, 2024
e8676ad
Fix original url for static page
tomaszstrojny Aug 4, 2024
1ebd733
fix when sites is empty
dzapek Aug 6, 2024
617f9a2
Preventing from adding too many queue jobs
tomaszstrojny Aug 9, 2024
31d21d7
Unique queue jobs dispatcher tested
tomaszstrojny Aug 10, 2024
6dfb531
Self review
tomaszstrojny Aug 10, 2024
a36128d
Merge branch 'feature/sitemap-translate' of github.com:initbiz/seosto…
tomaszstrojny Aug 12, 2024
8130691
fix translate attributes on static page
dzapek Aug 20, 2024
0e4c1e3
Merge branch 'feature/sitemap-translate' of github.com:initbiz/seosto…
dzapek Aug 20, 2024
a68e597
add return when hasttable in migration
dzapek Aug 21, 2024
def0dcc
Add used namespace
tomaszstrojny Sep 4, 2024
03d0ab1
Merge versions
tomaszstrojny Sep 7, 2024
b9d8200
Robots.txt updated
tomaszstrojny Sep 8, 2024
077fa58
Remove unused uses
tomaszstrojny Sep 8, 2024
6c1cb54
Merge pull request #93 from initbiz/feature/robots-favicon
tomaszstrojny Sep 8, 2024
7badfb0
Merge 4.9.0
tomaszstrojny Sep 8, 2024
55ab50f
Merge branch 'feature/sitemap-translate' of https://github.com/initbi…
tomaszstrojny Sep 8, 2024
c511a7a
Favicon initially works
tomaszstrojny Sep 10, 2024
603708d
Favicon ready
tomaszstrojny Sep 10, 2024
ad6d5c1
Self review
tomaszstrojny Sep 10, 2024
80b7c2e
404 when no file found
tomaszstrojny Sep 11, 2024
896a327
add test for delete item
dzapek Sep 11, 2024
b619d82
Self review
tomaszstrojny Sep 11, 2024
479774b
Merge branch 'feature/sitemap-translate' into add-test-for-delete-med…
tomaszstrojny Sep 11, 2024
a3cc263
Local cache + minor bug
tomaszstrojny Sep 12, 2024
aba9af1
Add timeout
tomaszstrojny Sep 12, 2024
19a85c8
Removed validation rule for favicon to keep backwards compatibility
tomaszstrojny Sep 13, 2024
1e59056
Fix creating new static pages
tomaszstrojny Sep 17, 2024
0063adc
Event to prevent adding new items and small minor fixes
tomaszstrojny Sep 18, 2024
390d11f
Support deferred binding for model saving
tomaszstrojny Sep 19, 2024
c4a33af
Change event on models to more relevant in our case
tomaszstrojny Sep 19, 2024
9e74d4c
Obvious minor fix
tomaszstrojny Sep 19, 2024
ac5aacf
Enable pages in sitemap and fix clearing ghosts
tomaszstrojny Sep 19, 2024
c742f9b
Clearing ghost sitemap items when updating Static pages
tomaszstrojny Sep 26, 2024
a8906b9
Move getSite lower
tomaszstrojny Sep 26, 2024
4a21d42
Scan later
tomaszstrojny Sep 26, 2024
237a619
Restart queue if workers are cached
tomaszstrojny Sep 26, 2024
94fd6e8
Chunk sitemap images records
tomaszstrojny Sep 27, 2024
13d717d
Fix tests
tomaszstrojny Sep 27, 2024
95fcf3f
Bug with running tests
tomaszstrojny Sep 27, 2024
e4ed1de
Add category to handlers
tomaszstrojny Sep 27, 2024
2cd3235
Queue job producing queue jobs
tomaszstrojny Oct 1, 2024
cd0fda9
Make request using loc from sitemapitem
tomaszstrojny Oct 15, 2024
f564301
add support mulisite for settings
dzapek Oct 18, 2024
615a463
cleanup
dzapek Oct 18, 2024
5207db4
add propagatable
dzapek Oct 18, 2024
3288735
Overwritten method findOtherSettingModel
dzapek Oct 21, 2024
b6cae25
add force refresh
dzapek Oct 21, 2024
76a9166
Move here, maybe it'll help
tomaszstrojny Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
.phpunit.result.cache
.phpunit.cache/

28 changes: 24 additions & 4 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Cms\Twig\Extension;
use Cms\Classes\Controller;
use System\Classes\PluginBase;
use Initbiz\SeoStorm\Classes\Router;
use Initbiz\SeoStorm\Models\Htaccess;
use Initbiz\SeoStorm\Models\Settings;
use Twig\Extension\StringLoaderExtension;
Expand Down Expand Up @@ -36,14 +37,19 @@ public function registerComponents()

public function register()
{
$this->registerConsoleCommand('migrate:arcane', \Initbiz\SeoStorm\Console\MigrateArcane::class);
$this->registerConsoleCommand('sitemap:refresh', \Initbiz\SeoStorm\Console\SitemapRefresh::class);
}

public function boot()
{
(new Router())->register();

Event::subscribe(\Initbiz\SeoStorm\EventHandlers\BackendHandler::class);
Event::subscribe(\Initbiz\SeoStorm\EventHandlers\StormedHandler::class);
Event::subscribe(\Initbiz\SeoStorm\EventHandlers\RainlabPagesHandler::class);
Event::subscribe(\Initbiz\SeoStorm\EventHandlers\RainlabTranslateHandler::class);
Event::subscribe(\Initbiz\SeoStorm\EventHandlers\SitemapHandler::class);

// Load Twig extensions

Expand Down Expand Up @@ -84,7 +90,7 @@ public function registerSettings()
'class' => Htaccess::class,
'order' => 200,
'permissions' => ['initbiz.manage_seo'],
]
],
];
}

Expand Down Expand Up @@ -123,7 +129,7 @@ public function templateFromString($template)
public function registerStormedModels()
{
$modelDefs = [
'Rainlab\Blog\Models\Post' => [
\Rainlab\Blog\Models\Post::class => [
'placement' => 'secondaryTabs',
'excludeFields' => [
'model_class',
Expand All @@ -136,9 +142,23 @@ public function registerStormedModels()
'enabled_in_sitemap',
],
],

\Rainlab\Blog\Models\Category::class => [
'placement' => 'tabs',
'excludeFields' => [
'model_class',
'model_scope',
'model_params',
'lastmod',
'use_updated_at',
'changefreq',
'priority',
'enabled_in_sitemap',
],
],
];

if (env('APP_ENV') === 'testing') {
if (\App::runningUnitTests()) {
$modelDefs['\Initbiz\SeoStorm\Tests\Classes\FakeStormedModel'] = [
'placement' => 'tabs',
'excludeFields' => [
Expand All @@ -153,7 +173,7 @@ public function registerStormedModels()
public function registerFormWidgets()
{
return [
'\Initbiz\SeoStorm\FormWidgets\Migrate' => 'seo_migrate'
\Initbiz\SeoStorm\FormWidgets\Migrate::class => 'seo_migrate'
];
}
}
47 changes: 0 additions & 47 deletions classes/FaviconController.php

This file was deleted.

39 changes: 0 additions & 39 deletions classes/Robots.php

This file was deleted.

11 changes: 0 additions & 11 deletions classes/RobotsController.php

This file was deleted.

90 changes: 90 additions & 0 deletions classes/Router.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?php

namespace Initbiz\SeoStorm\Classes;

use Site;
use Route;
use Initbiz\SeoStorm\Models\Settings;
use Initbiz\SeoStorm\Controllers\RobotsController;
use Initbiz\SeoStorm\Controllers\FaviconController;
use Initbiz\SeoStorm\Controllers\SitemapController;
use Initbiz\SeoStorm\Controllers\WebmanifestController;

/**
* SEO Storm router - will register routings for sitemaps, robots, etc.
* if enabled in settings
*/
class Router
{
public function register(): void
{
$settings = Settings::instance();

if ($settings->get('enable_sitemap')) {
$this->registerSitemapRouting();
}

if ($settings->get('enable_robots_txt')) {
$this->registerRobotsRouting();
}

if ($settings->get('favicon_enabled')) {
$this->registerFaviconRouting();
}

if ($settings->get('webmanifest_enabled')) {
$this->registerWebmanifestRouting();
}
}

public function registerSitemapRouting(): void
{
$settings = Settings::instance();
$sites = $settings->getSitesEnabledInSitemap();

foreach ($sites as $site) {
$prefix = $site->is_prefixed ? $site->route_prefix : '';

Route::get($prefix . '/sitemap.xml', [SitemapController::class, 'sitemap']);

if ($settings->get('enable_index_sitemap')) {
Route::get($prefix . '/sitemap_index.xml', [SitemapController::class, 'index']);
}

if ($settings->get('enable_videos_sitemap')) {
Route::get($prefix . '/sitemap_videos.xml', [SitemapController::class, 'videos']);
}

if ($settings->get('enable_images_sitemap')) {
Route::get($prefix . '/sitemap_images.xml', [SitemapController::class, 'images']);
}
}
}

public function registerRobotsRouting(): void
{
$sites = Site::listSites();
foreach ($sites as $site) {
$prefix = $site->is_prefixed ? $site->route_prefix : '';
Route::get($prefix . '/robots.txt', [RobotsController::class, 'index']);
}
}

public function registerFaviconRouting(): void
{
$sites = Site::listSites();
foreach ($sites as $site) {
$prefix = $site->is_prefixed ? $site->route_prefix : '';
Route::get($prefix . '/favicon.ico', [FaviconController::class, 'faviconIco']);
}
}

public function registerWebmanifestRouting(): void
{
$sites = Site::listSites();
foreach ($sites as $site) {
$prefix = $site->is_prefixed ? $site->route_prefix : '';
Route::get($prefix . '/manifest.webmanifest', [WebmanifestController::class, 'index']);
}
}
}
Loading