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

Automatic functionality for records not working #550

Open
ste101 opened this issue Aug 20, 2023 · 4 comments · Fixed by #553
Open

Automatic functionality for records not working #550

ste101 opened this issue Aug 20, 2023 · 4 comments · Fixed by #553

Comments

@ste101
Copy link

ste101 commented Aug 20, 2023

I tried to add the Yoast field to an extension via 'automatic functionality' but I'm having some problems.
This is my configuration:

\YoastSeoForTypo3\YoastSeo\Utility\RecordUtility::configureForRecord('tx_sfeventmgt_domain_model_event')
     ->setGetParameters([
         ['tx_sfeventmgt_pieventdetail', 'event'],
     ])
     ->setSitemapFields(false)
     ->setAddDescriptionField('seo_description')
     ->setDescriptionField('seo_description')
     ->setFieldsPosition('after:custom_text');

The field will show up in backend but 'SitemapFields' show up, 'description' also although I set ->setAddDescriptionField('seo_description')
->setDescriptionField('seo_description')
grafik

The biggest problem is that the seo field are not added to the database and so I'm getting errors like
PHP Warning: Undefined array key "og_image" in /html/typo3/typo3conf/ext/yoast_seo/Classes/MetaTag/Generator/OpenGraphGenerator.php line 29
Preview config:

TCEMAIN.preview {
    tx_sfeventmgt_domain_model_event {
        previewPageId = 10
        useCacheHash = 1
        useDefaultLanguageRecord = 0
        fieldToParameterMap {
                uid = tx_sfeventmgt_pieventdetail[event]
        }
        additionalGetParameters {
                tx_sfeventmgt_pieventdetail.controller = Event
                tx_sfeventmgt_pieventdetail.action = detail
        }
    }
}

Technical info

  • TYPO3 version: 12.4.5
  • Yoast SEO version: 9.0.1
@RinyVT
Copy link
Collaborator

RinyVT commented Aug 31, 2023

Hi @ste101!

I have tested with the extension sf_event_mgt, if the seo_description field is a new field you wish to add then the setAddDescriptionField should be a boolean true instead of a string.
In this case a new field will be added to TCA and database, based on the description field of the pages table.

The extra description field which is seen below the cornerstone field, is because the sf_event_mgt already has a description field and the seo palette from pages is being copied and that palette already contains the description field.

In this case I think the only way to prevent that is to override the palette, the total configuration will look like this:

\YoastSeoForTypo3\YoastSeo\Utility\RecordUtility::configureForRecord('tx_sfeventmgt_domain_model_event')
    ->setGetParameters([
        ['tx_sfeventmgt_pieventdetail', 'event']
    ])
    ->setSitemapFields(false)
    ->setAddDescriptionField(true)
    ->setDescriptionField('seo_description')
    ->setFieldsPosition('after:custom_text')
    ->setOverrideTca([
        'palettes' => [
            'seo' => [
                'showitem' => '--linebreak--, tx_yoastseo_snippetpreview,
                    --linebreak--, seo_title;LLL:EXT:seo/Resources/Private/Language/locallang_tca.xlf:pages.seo_title,
                    --linebreak--, seo_description,
                    --linebreak--, tx_yoastseo_cornerstone,'
            ]
        ]
    ]);

Sidenote: the sf_event_mgt already has a meta_description field, this may conflict with your custom seo_description field.

Regarding the sitemap fields and the errors in the frontend, those are indeed bugs. I will open a bugfix PR as soon as possible!

@RinyVT
Copy link
Collaborator

RinyVT commented Aug 31, 2023

@ste101 I have just added a PR: #553, could you test this?

Regarding the fields not being added to the database, when you run the database analyzer (after clearing system cache) the fields do not show up?

Regarding the preview, it looks like there's no absolute URL being generated, two things to check:

  • page id 10 exists and is not hidden?
  • do you have a valid url as your site configuration base?

@ste101
Copy link
Author

ste101 commented Sep 8, 2023

Regarding the fields not being added to the database, when you run the database analyzer (after clearing system cache) the fields do not show up?

Yes they show up.
I thought that they are added automatically. Could you add a sentence about this to the docu?

I tried to reuse the exitings fields alternative_title and meta_description. They show up in SEO tab but the progress bar does not show up:
grafik
I used ->setTitleField('alternative_title') but the database analyser still shows
ALTER TABLE tx_sfeventmgt_domain_model_event ADD seo_title VARCHAR(255) DEFAULT '' NOT NULL

Removing the configured fields from the Metadata tab would be great also as you doing this at the page properties.

Maybe it would be got to have the possibility to switch off twitter and opengraph.

Thank you very much.

@RinyVT RinyVT reopened this Sep 12, 2023
@ste101
Copy link
Author

ste101 commented Apr 11, 2024

The progress bars and the preview update still does not work.
I can see this error message in the browser console:
grafik

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