Skip to content

Commit

Permalink
Restore and update laravelium/sitemap package.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbaldessin committed Sep 17, 2020
1 parent a101b24 commit 063af08
Show file tree
Hide file tree
Showing 5 changed files with 115 additions and 37 deletions.
40 changes: 20 additions & 20 deletions app/Console/Commands/GenerateSitemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public function handle()

// generate new sitemap file
$sitemap = \App::make('sitemap');

$counter = 0;
$sitemapCounter = 0;
$sitemaps_path = public_path().DIRECTORY_SEPARATOR.'sitemaps';

$sitemaps_path = public_path() . DIRECTORY_SEPARATOR . 'sitemaps';

// Add selections dynamic sitemap.
$sitemap->addSitemap(secure_url(route('selections_sitemap', [], false)));
Expand All @@ -71,24 +71,24 @@ public function handle()
$images = [];
if ($p->images) {
$images = $p->images()
->where('is_published', true)
->orderBy('is_poster', 'DESC')
->orderBy('is_prime_quality', 'DESC')
->get()
->map(function ($i) {
$attrs = [
'url' => secure_url('/media/orig/' . $i->path),
// 'title' => '',
// 'caption' => '',
];
// Not currently active with this package.
if (isset($i->licence) && $i->licence === 'LO 2.0') {
$attrs['license'] = 'https://github.com/etalab/licence-ouverte/blob/master/LO.md';
}
return $attrs;
})->all();
->where('is_published', true)
->orderBy('is_poster', 'DESC')
->orderBy('is_prime_quality', 'DESC')
->get()
->map(function ($i) {
$attrs = [
'url' => secure_url('/media/orig/' . $i->path),
// 'title' => '',
// 'caption' => '',
];
// Not currently active with this package.
if (isset($i->licence) && $i->licence === 'LO 2.0') {
$attrs['license'] = 'https://github.com/etalab/licence-ouverte/blob/master/LO.md';
}
return $attrs;
})->all();
}

// add product to items array
// $p->freq = 'weekly';
// $p->priority = '0.5';
Expand Down Expand Up @@ -117,6 +117,6 @@ public function handle()
$sitemap->store('sitemapindex', 'sitemap', $sitemaps_path);

$end = microtime(true);
$this->info("Took ".($end - $start) ." seconds to complete\n");
$this->info("Took " . ($end - $start) . " seconds to complete\n");
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"laravel/scout": "^8.1.0",
"laravel/tinker": "^2.4",
"laravel/ui": "^2.0",
"laravelium/sitemap": "7.*",
"league/flysystem": "^1.0",
"league/flysystem-memory": "^1.0",
"nothingworks/blade-svg": "^0.3",
Expand Down
72 changes: 68 additions & 4 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 12 additions & 13 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
*/

'name' => env('APP_NAME', 'Laravel'),

Expand All @@ -24,7 +24,7 @@
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
*/

'env' => env('APP_ENV', 'production'),

Expand All @@ -37,10 +37,10 @@
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
*/

'debug' => env('APP_DEBUG', false),

'editor' => 'vscode',

/*
Expand All @@ -52,7 +52,7 @@
| the Artisan command line tool. You should set this to the root of
| your application so that it is used when running Artisan tasks.
|
*/
*/

'url' => env('APP_URL', 'http://localhost'),

Expand All @@ -65,7 +65,7 @@
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
*/

'timezone' => 'UTC',

Expand All @@ -78,7 +78,7 @@
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
*/

'locale' => 'fr',

Expand All @@ -91,7 +91,7 @@
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
*/

'fallback_locale' => 'en',

Expand All @@ -104,7 +104,7 @@
| to a random, 32 character string, otherwise these encrypted strings
| will not be safe. Please do this before deploying an application!
|
*/
*/

'key' => env('APP_KEY'),

Expand All @@ -119,7 +119,7 @@
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
*/

'providers' => [

Expand Down Expand Up @@ -165,7 +165,6 @@
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,


],

/*
Expand All @@ -177,7 +176,7 @@
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
*/

'aliases' => [

Expand Down Expand Up @@ -225,6 +224,6 @@
'datasource_password' => env('DATASOURCE_PASSWORD'),
'http_auth_username' => env('HTTP_AUTH_USERNAME'),
'http_auth_password' => env('HTTP_AUTH_PASSWORD'),
'oai_admin_emails_array' => array_map('trim', explode(',', env('OAI_ADMIN_EMAILS')))
'oai_admin_emails_array' => array_map('trim', explode(',', env('OAI_ADMIN_EMAILS'))),

];
14 changes: 14 additions & 0 deletions config/sitemap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php

/* Simple configuration file for Laravel Sitemap package */
return [
'use_cache' => false,
'cache_key' => 'laravel-sitemap.' . config('app.url'),
'cache_duration' => 3600,
'escaping' => true,
'use_limit_size' => false,
'max_size' => null,
'use_styles' => false,
'styles_location' => '/vendor/sitemap/styles/',
'use_gzip' => false,
];

0 comments on commit 063af08

Please sign in to comment.