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

Snippetpreview misbehaving on pages with start-/endtime #319

Open
2 tasks done
helsner opened this issue Dec 19, 2019 · 1 comment
Open
2 tasks done

Snippetpreview misbehaving on pages with start-/endtime #319

helsner opened this issue Dec 19, 2019 · 1 comment
Milestone

Comments

@helsner
Copy link
Contributor

helsner commented Dec 19, 2019

  • I've read and understood the contribution guidelines.
  • I've searched for any related issues and avoided creating a duplicate issue.

Please give us a description of what happened.

The snippetpreview function does not show the correct preview of pages that have start and endtime settings.
This should be because of the restrictions, that are not removed when accessing the page within the snippetpreview.

Please describe what you expected to happen and why.

I expected the correct meta information of the page.
Hidden pages work, as the restriction is removed AFAIK

How can we reproduce this behavior?

  1. create a page with e.g. a starttime (publish date) in the future
  2. check the snippetpreview which should show the rootpage or comparable but not the right meta

Technical info

  • TYPO3 version: v9 LTS
  • Yoast SEO version: v5.0.0 (and above i guess)
@helsner
Copy link
Contributor Author

helsner commented Feb 21, 2025

So its been over 5 years 😂 we got a solution on our own by now, but i want to provide that @RinyVT

First: for the PageRequestMiddleware we got a simple override, that changes the VisibilityAspect
instead of a simple true, we add true, false, false, true as Params

This solves the main issue.
But when using redis this causes another issue, because for pages, that have an endtime in the past the cache entry is a negative value which breaks within redis

to solve this we got a second override.
In earlier version we used the initCaches method in StructuredDataProviderManager, now we override the constructor.
It basically looks like this:

public function __construct(
        protected FrontendInterface $pageCache
    ) {
        if (!($GLOBALS['TYPO3_REQUEST'] ?? null) instanceof ServerRequestInterface ||
            !ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend() ||
            $this->getCacheTimeout() >= 0
        ) {
            return;
        }

        $this->pageCache = new VariableFrontend('dummy', new NullBackend(''));
    }

Maybe you find a better solution and improve this
Or an event is added to handle the cache in a better way

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

No branches or pull requests

2 participants