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

AfterCacheableContentIsGeneratedListener overwrites TYPOSCRIPT generated meta title. #678

Closed
Fanor51 opened this issue Nov 17, 2023 · 6 comments · Fixed by #679
Closed
Labels
bug Something isn't working

Comments

@Fanor51
Copy link
Contributor

Fanor51 commented Nov 17, 2023

Version(s)

PHP: 8.2.11
TYPO3: v12.4.7
Headless: v4.2.2

Description

Hello,

I ran in the issue that my meta page titles in plugins, which are setted via typoscript and record values, are overwritten by the Page Title. I saw the changes in 4.2.2 here with the support for the PageTitle Provider (https://github.com/TYPO3-Headless/headless/pull/628/files) and my question is if this was intended to remove the TS Support?

image
("Fahrzeugangebot" is the page title on which the "show" action is located.)

This Condition :

            if (($content['meta']['title'] ?? null) === null) {
                return;
            }

breaks it in my case. With the negation this works.

            if (($content['meta']['title'] ?? null) !== null) {
                return;
            }

My TYPOSCRIPT looks like this and is loaded after the headless TYPOSCRIPT


...
    /**
    * Create TITLE
    */
    carTitle = RECORDS
    carTitle {
      dontCheckPid = 1
      tables = tx_bracar_domain_model_car
      source {
        data = GP:tx_bracar_cardetail|product
        intval = 1
      }
      conf.tx_bracar_domain_model_car = TEXT
      conf.tx_bracar_domain_model_car {
        field = seo_title
        stdWrap.stripHtml = 1
      }
    }

....


    meta.fields {
      # remove fields
      subtitle >
      abstract >
      keywords >
      author >
      authorEmail >
      ogImage >
      twitterImage >

      # add slug
      canonical =< lib.carSlug

      # add title
      title =< lib.carTitle
      twitterTitle =< lib.carTitle
      ogTitle =< lib.carTitle

      # add description
      description =< lib.carDescription
      ogDescription =< lib.carDescription
      twitterDescription =< lib.carDescription

      # add image
      ogImage.fields {
        publicUrl =< lib.carImage
      }
      twitterImage.fields {
        publicUrl =< lib.carImage
      }
    }

image

For the other fields it looks still good.

So my question is: Was this intended or is this a bug? Do i need to refactor this and add page title providers to controller/record titles ?

If this is a bug i can create a PR with a in my eyes bugfix.

Thanks for your work and support on this!
Best Regards
Fabio

@Fanor51 Fanor51 added the bug Something isn't working label Nov 17, 2023
@lukaszuznanski
Copy link
Collaborator

Hi, it was not intended, this should work only if you set it explicitly.

@twoldanski
Copy link
Collaborator

@Fanor51 I will take a look, but this condition is for other types of responses.

twoldanski added a commit that referenced this issue Nov 17, 2023
twoldanski added a commit that referenced this issue Nov 17, 2023
@twoldanski
Copy link
Collaborator

Hi @Fanor51, we decided with Łukasz, that we put this feature behind flag for now, because of needed migration. You would like to use this feature in your app, you should migrate to PageTitle API (register custom Provider)

twoldanski added a commit that referenced this issue Nov 17, 2023
@Fanor51
Copy link
Contributor Author

Fanor51 commented Nov 17, 2023

Hallo @twoldanski & @lukaszuznanski ,

thanks for the help.
Alright i understand and think thats a good workarround. For now i would disable this and migrate it in some spare time.

Thanks!

@Fanor51
Copy link
Contributor Author

Fanor51 commented Nov 17, 2023

@twoldanski How should we proceed with the issue? Can I test something else or should I close this or will you do it there?

Fabio

@twoldanski
Copy link
Collaborator

@Fanor51 issue will be automatically closed after merge. You can apply this patch right now if you want, and old behavior should apply if flag is not enabled.

lukaszuznanski pushed a commit that referenced this issue Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants