AppoloDev / bolt-seo

Bolt 5 - SEO extension
https://appolo.fr
MIT License
10 stars 9 forks source link

Support custom Record route names #18

Open nestordedios opened 3 years ago

nestordedios commented 3 years ago

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 https://github.com/AppoloDev/bolt-seo/blob/4aad5ae17fb5355e4d27d9cfe66fd15662b4a74a/src/Seo/Seo.php#L263-L272

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 commented 3 years ago

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