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

Support custom Record route names #18

Open
nestordedios opened this issue Mar 30, 2021 · 1 comment
Open

Support custom Record route names #18

nestordedios opened this issue Mar 30, 2021 · 1 comment

Comments

@nestordedios
Copy link

Hi!

I don't know if this is already implemented but it seems not to work as I expect with the default installation.

In my use case I have defined a Contenttype with custom names for the record_route option and this seems to give some troubles to the extension to properly work.

Specially when doing this type of checks on the routeType, since the record_route option is set like record_route: content_seo (in my example) it will never match any of the cases in the switch statements in the SEO.php class. See for example

bolt-seo/src/Seo/Seo.php

Lines 263 to 272 in 4aad5ae

switch ($this->routeType) {
case 'record':
case 'homepage':
if ($this->record) {
$field = $this->getField($this->record, 'image');
if ($field && $field->__toString() !== '') {
return $this->request->getSchemeAndHttpHost().$this->cleanUp($field->__toString());
}
}
}

My contenttypes.yml

pages:
    name: Pages
    singular_name: Page
    fields:
        title:
            type: text
            class: large
            group: content
        subtitle:
            type: text
        slug:
            type: slug
            uses: title
        image:
            type: image
        content:
            type: article
        template:
            type: templateselect
            filter: '*.twig'
            default: 'page.twig'
        seo:
            type: seo
            group: "SEO settings"
    records_per_page: 50
    record_route: content_seo

What I would like to achieve is that the extension works the same as it does when there are no modifications on the record_route Contenttype option.

Is there a way to make this work?

@Fredxd
Copy link
Contributor

Fredxd commented Mar 30, 2021

Hi

I will try to look this case when i will have time. But feel you free to update code and do an PR if you want ;)

Regards

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