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

fix: don't duplicate dash in URL #138

Merged
merged 4 commits into from
Jun 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 1 addition & 1 deletion js/dist/forum.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dist/forum.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/src/forum/pages/BlogItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class BlogItem extends Page {
}

// Read post on load
if (!article.lastReadPostNumber()) {
if (app.session.user && !article.lastReadPostNumber()) {
article.save({ lastReadPostNumber: 1 });
}

Expand Down
12 changes: 6 additions & 6 deletions src/Controller/BlogItemController.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ public function __invoke(Document $document, ServerRequestInterface $request)

// Set social media title
\V17Development\FlarumSeo\Extend::setTitle($apiDocument->data->attributes->title, false);

// Article URL
$fullArticleUrl = $this->url->to('forum')->route('blog.post', ['id' => $apiDocument->data->id . '-' . $apiDocument->data->attributes->slug]);
$fullArticleUrl = $this->url->to('forum')->route('blog.post', ['id' => $apiDocument->data->attributes->slug]);

\V17Development\FlarumSeo\Extend::setUrl($fullArticleUrl, false);
\V17Development\FlarumSeo\Extend::setCanonicalUrl($fullArticleUrl);

\V17Development\FlarumSeo\Extend::setSchemaJson('@type', 'BlogPosting');

// Article image
$articleHasImage = false;

Expand All @@ -72,15 +72,15 @@ public function __invoke(Document $document, ServerRequestInterface $request)
\V17Development\FlarumSeo\Extend::setImage($blogMeta->featured_image);
}
}

// Set featured image
if(!$articleHasImage && $this->settings->get('blog_default_image_path', null) !== null) {
\V17Development\FlarumSeo\Extend::setImage($this->url->to('forum')->base() . "/assets/" . $this->settings->get('blog_default_image_path', null));
}

// Add article changed
\V17Development\FlarumSeo\Extend::setPublishedOn($apiDocument->data->attributes->createdAt);

// Add article update time
if (isset($apiDocument->data->attributes->metaLastEditedTime)) {
\V17Development\FlarumSeo\Extend::setUpdatedOn($apiDocument->data->attributes->metaLastEditedTime);
Expand Down Expand Up @@ -112,4 +112,4 @@ private function getApiDocument(ServerRequestInterface $request, $id)

return json_decode($response->getBody());
}
}
}