0

I configured a block to be shown only on the front page, but the front page is actually a view of the last published nodes, with a pager, and the block is shown on each of its pages.

Is there any convenient way to show the block only once? I know it is possible to write a hook that checks if the page parameter is set and hide the block in that case.

What hook should I use to achieve this?

1 Answer 1

0

You could create a custom @Condition plugin, where the result is true when on the first page, and false whenever a URL parameter exists for page. Then you could set this context as the block context.

I wrote a tutorial on creating custom @Condition plugins here: https://www.jaypan.com/tutorial/custom-drupal-block-visibility-plugins-and-condition-plugin-api

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.