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

DocumentRenderer: setCurrentSite to generate correct path of document in static page generator #16644

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

Conversation

melissakittl
Copy link
Contributor

Problem

Static page generation via cli does not consider current site, what causes wrong link generation of documents in the generated static files.

Expected behavior

When using sites in pimcore, the static page files contains correct generated links by pimcore_linketc., like /en/products.

Actual behavior

When running bin/console pimcore:maintenance --job=documents_static_page_generate or bin/console pimcore:documents:generate-static-pages static page files are generated with links like /my-site/en/products instead of /en/products

Changes in this pull request

Set current site in DocumentRenderer, if site was found, to ensure correct link generation

Copy link

Review Checklist

  • Target branch (11.1 for bug fixes, others 11.x)
  • Tests (if it's testable code, there should be a test for it - get help)
  • Docs (every functionality needs to be documented, see here)
  • Migration incl. install.sql (e.g. if the database schema changes, ...)
  • Upgrade notes (deprecations, important information, migration hints, ...)
  • Label
  • Milestone

@kingjia90 kingjia90 deleted the branch pimcore:11.2 March 12, 2024 15:13
@kingjia90 kingjia90 closed this Mar 12, 2024
@melissakittl
Copy link
Contributor Author

@kingjia90
This is still relevant for static pages to work properly.

@kingjia90
Copy link
Contributor

kingjia90 commented Mar 13, 2024

@melissakittl Sorry for the PR getting closed, this was not intentional, as soon as i deleted the base branch 11.1 (due 11.2 being released), it automatically closed the PRs targeting 11.1.
Re-opening all

@kingjia90 kingjia90 reopened this Mar 13, 2024
@kingjia90 kingjia90 changed the base branch from 11.1 to 11.2 March 13, 2024 07:34
Copy link

sonarcloud bot commented Mar 13, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@melissakittl
Copy link
Contributor Author

Hi @kingjia90,
any news about this?

@kingjia90
Copy link
Contributor

Thank you for the PR, haven't yet dig into it, but on a first look, it seems that it would be "safer" to have it under

if ($attributes['pimcore_static_page_generator'] ?? false) {
   if (isset($site)){
      Site::setCurrentSite($site);
      ...

not quite sure how it worked before for other cases where this render is used and if your suggested changes fixes an overall broken behavior or if it's the specific static page case are affected.

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

Successfully merging this pull request may close these issues.

None yet

3 participants