diff --git a/src/Backend/Modules/Blog/Installer/Data/locale.xml b/src/Backend/Modules/Blog/Installer/Data/locale.xml
index e703f0cf54..87bb56c517 100644
--- a/src/Backend/Modules/Blog/Installer/Data/locale.xml
+++ b/src/Backend/Modules/Blog/Installer/Data/locale.xml
@@ -435,6 +435,15 @@
+
+ -
+
+
+
+
+
+
+
-
diff --git a/src/Backend/Modules/Blog/Installer/Installer.php b/src/Backend/Modules/Blog/Installer/Installer.php
index 86305b6a47..e85361ab9e 100644
--- a/src/Backend/Modules/Blog/Installer/Installer.php
+++ b/src/Backend/Modules/Blog/Installer/Installer.php
@@ -17,6 +17,9 @@ class Installer extends ModuleInstaller
/** @var int */
private $blogBlockId;
+ /** @var int */
+ private $blogBlockDetailId;
+
public function install(): void
{
$this->addModule('Blog');
@@ -101,6 +104,7 @@ private function configureBackendWidgets(): void
private function configureFrontendExtras(): void
{
$this->blogBlockId = $this->insertExtra($this->getModule(), ModuleExtraType::block(), 'Blog');
+ $this->blogBlockDetailId = $this->insertExtra($this->getModule(), ModuleExtraType::block(), 'Detail', 'Detail');
$this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Archive', 'Archive');
$this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'Categories', 'Categories');
$this->insertExtra($this->getModule(), ModuleExtraType::widget(), 'RecentArticlesFull', 'RecentArticlesFull');
@@ -131,13 +135,20 @@ private function configureFrontendPages(): void
$this->setSetting($this->getModule(), 'rss_description_' . $language, '');
// check if a page for blog already exists in this language
- if (!$this->hasPageWithBlogBlock($language)) {
- $this->insertPage(
+ if (!$this->hasPageWithBlogBlock($language, $this->blogBlockId)) {
+ $indexId = $this->insertPage(
['title' => 'Blog', 'language' => $language],
null,
['extra_id' => $this->blogBlockId, 'position' => 'main'],
['extra_id' => $searchId, 'position' => 'top']
);
+ if (!$this->hasPageWithBlogBlock($language, $this->blogBlockDetailId)) {
+ $this->insertPage(
+ ['title' => 'Detail', 'language' => $language, 'parent_id' => $indexId],
+ null,
+ ['extra_id' => $this->blogBlockDetailId, 'position' => 'main'],
+ );
+ }
}
if ($this->installExample()) {
@@ -182,7 +193,7 @@ private function getSearchWidgetId(): int
);
}
- private function hasPageWithBlogBlock(string $language): bool
+ private function hasPageWithBlogBlock(string $language, int $blockId): bool
{
// @todo: Replace with a PageRepository method when it exists.
return (bool) $this->getDatabase()->getVar(
@@ -191,7 +202,7 @@ private function hasPageWithBlogBlock(string $language): bool
INNER JOIN pages_blocks AS b ON b.revision_id = p.revision_id
WHERE b.extra_id = ? AND p.language = ?
LIMIT 1',
- [$this->blogBlockId, $language]
+ [$blockId, $language]
);
}
diff --git a/src/Frontend/Modules/Blog/Actions/Detail.php b/src/Frontend/Modules/Blog/Actions/Detail.php
index ac6e7cc617..f8d8711b41 100644
--- a/src/Frontend/Modules/Blog/Actions/Detail.php
+++ b/src/Frontend/Modules/Blog/Actions/Detail.php
@@ -65,17 +65,17 @@ protected function setMeta(Meta $meta): void
private function getBlogPost(): array
{
- if ($this->url->getParameter(1) === null) {
+ if ($this->url->getParameter(0) === null) {
throw new NotFoundHttpException();
}
if ($this->url->getParameter('revision', 'int') === null) {
- return $this->completeBlogPost(FrontendBlogModel::get($this->url->getParameter(1)));
+ return $this->completeBlogPost(FrontendBlogModel::get($this->url->getParameter(0)));
}
return $this->completeBlogPost(
FrontendBlogModel::getRevision(
- $this->url->getParameter(1),
+ $this->url->getParameter(0),
$this->url->getParameter('revision', 'int')
)
);