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

Correct URL for categories if Blog is on /home #804

Open
wants to merge 1 commit into
base: 4
Choose a base branch
from

Conversation

lerni
Copy link
Contributor

@lerni lerni commented Jan 22, 2025

Description

true in BlogObject->getLink() to get correct URL for categories also if Blog is on /home

If Blog is on /home, $this->Blog()->Link() returns just / but should return /home for categories. Adding true as parameter in https://github.com/silverstripe/silverstripe-blog/blob/4/src/Model/BlogObject.php#L86 to ->Link()fixes this. See also:
https://github.com/silverstripe/silverstripe-cms/blob/5/code/Model/SiteTree.php#L715

Manual testing steps

Install Blog on /home and see categories fail

[User Warning] Request handler SilverStripe\CMS\Controllers\ModelAsController does not have a url_segment defined. Relying on this link may be an application error
GET /category/...

Line 573 in /var/www/html/vendor/silverstripe/framework/src/Control/RequestHandler.php

Issues

Pull request checklist

  • The target branch is correct
  • All commits are relevant to the purpose of the PR (e.g. no debug statements, unrelated refactoring, or arbitrary linting)
    • Small amounts of additional linting are usually okay, but if it makes it hard to concentrate on the relevant changes, ask for the unrelated changes to be reverted, and submitted as a separate PR.
  • The commit messages follow our commit message guidelines
  • The PR follows our contribution guidelines
  • Code changes follow our coding conventions
  • This change is covered with tests (or tests aren't necessary for this change)
  • Any relevant User Help/Developer documentation is updated; for impactful changes, information is added to the changelog for the intended release
  • CI is green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant