Skip to content

Commit

Permalink
fix: don't create manifest by default
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardBaumrock committed Jan 28, 2024
1 parent 15ad6cf commit 1b17b86
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
8 changes: 6 additions & 2 deletions RockFrontend.module.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ class RockFrontend extends WireData implements Module, ConfigurableModule
public $autoloadScripts;
public $autoloadStyles;

public $createManifest = false;

/** @var WireArray $folders */
public $folders;

Expand Down Expand Up @@ -2094,8 +2096,10 @@ public function rm()
/**
* @return Seo
*/
public function seo()
{
public function seo(
bool $createManifest = false,
) {
$this->createManifest = $createManifest;
if ($this->seo) return $this->seo;
require_once __DIR__ . "/Seo.php";
return $this->seo = new Seo();
Expand Down
29 changes: 15 additions & 14 deletions Seo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

class Seo extends Wire
{

/** @var array */
protected $rawValues;

Expand Down Expand Up @@ -369,19 +368,21 @@ public function ___setupDefaults()
});

// webmanifest
$this->setMarkup('manifest', '<link rel="manifest" href="{value}">');
$this->setValue('manifest', function () {
/** @var RockFrontend $rf */
$rf = $this->wire->modules->get('RockFrontend');
$manifest = $rf->manifest();
return $manifest->url();
});
$this->setMarkup('theme-color', '<meta name="theme-color" content="{value}">');
$this->setValue('theme-color', function () {
/** @var RockFrontend $rf */
$rf = $this->wire->modules->get('RockFrontend');
return $rf->manifest()->themeColor;
});
if ($this->rockfrontend()->createManifest) {
$this->setMarkup('manifest', '<link rel="manifest" href="{value}">');
$this->setValue('manifest', function () {
/** @var RockFrontend $rf */
$rf = $this->wire->modules->get('RockFrontend');
$manifest = $rf->manifest();
return $manifest->url();
});
$this->setMarkup('theme-color', '<meta name="theme-color" content="{value}">');
$this->setValue('theme-color', function () {
/** @var RockFrontend $rf */
$rf = $this->wire->modules->get('RockFrontend');
return $rf->manifest()->themeColor;
});
}
}

/**
Expand Down
4 changes: 3 additions & 1 deletion profiles/rockpagebuilder/files/site/templates/_init.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace ProcessWire;

/** @var RockFrontend $rockfrontend */

$htmlLang = "de";

$rockfrontend->styles()
Expand All @@ -15,5 +17,5 @@
->add('/site/templates/scripts/main.js', 'defer')
->minify(!$config->debug);

$seo = $rockfrontend->seo()
$seo = $rockfrontend->seo(createManifest: false)
->title($page->title . " | example.com");

0 comments on commit 1b17b86

Please sign in to comment.