Skip to content

calling twig function through theme hook - #11

Open
robinallezard wants to merge 2 commits into
mainfrom
feat/theme-hook
Open

calling twig function through theme hook#11
robinallezard wants to merge 2 commits into
mainfrom
feat/theme-hook

Conversation

@robinallezard

@robinallezard robinallezard commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

@anoziere anoziere left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The renames and the theme-hook direction are fine, but there is a structural problem with moving <title> and og:type into the hook template.

head-top.html.twig is rendered by SEOneThemeHook as a standalone Twig render, outside the theme's inheritance chain. In flexy, around 25 templates override {% block title %} (404, faq, checkout, account, ...) and the product/content templates override {% block og_type %}. Once the layout stops declaring those blocks, every one of those overrides becomes dead code: the title falls back to the generic SEOnePageTitle() default on every non-catalog page, and og:type is hardcoded to website, including on product pages. Keeping title/og_type as overridable blocks in the layout (with the hook filling the defaults), or passing per-view values into the hook, would avoid the regression. This should be looked at together with thelia-templates/flexy#124.

Smaller things: the new SEOneThemeHook.php is missing declare(strict_types=1); head-top.html.twig assigns pageDesc/canonical to variables and then calls the same functions again a few lines below (double event dispatch); and the match in the hook has no default arm, so it only stays safe as long as supports() lists exactly the same strings.

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

Successfully merging this pull request may close these issues.

2 participants