Page without Primary Image

Is there a possibility to deselect “primary image” that appears at the top of the page in full size?
When I add images to a page (e.g. with Page Template “Default”) via the Page Media section it automatically uses the first image as primary image even if I not select any. But I only want to use the pictures within the text of the page.

@Thorben,

When I add images to a page (e.g. with Page Template “Default”) via the Page Media section it automatically uses the first image as primary image even if I not select any.

That behaviour is entirely defined by how config and templates have been designed for the theme being used. If the theme does not provide the option to select, or omit, a hero image, or does not provide a suitable template without a hero image, you will have to either choose another theme, or create a child theme and add a new template or override the template of the original (parent) theme.

Yes, like pamtbaau mention you can achive that using one of those methods…

Below example what to do in theme:

First create switch in blueprint, so U need to go to

/user/themes/(theme name)/blueprints/

chose file u want to edit - for example blog.yaml and add something like:

        header.content.primary:
          type: toggle
          label: Primary image
          highlight: 1
          default: 1
          options:
            1: PLUGIN_ADMIN.ENABLED
            0: PLUGIN_ADMIN.DISABLED
          validate:
            type: bool

then go to

/user/themes/(theme name)/templates/

and find file that contain info about your main image - might be in blog.html.twig or can be in partials folder.

Now you need to wrap image in to a toggle checking code

something like

{% if header.content.primary == 1 %}
  {{ page.media.images|first.html() | raw }}
{% endif %}

Hope this will help. Sorry for spelling mistakes… I’m from land of pierogi :rofl:

@Thorben, Future2021 and Editorial themes already have implemented the option to show or not the primary image

You can see them in above links to reuse the code in your project

@pmoreno: I‘m using the future2021 theme. I only see a drop-down to select which one. But where would I disable it?
Best regards

@Thorben, If you are using the latest version of the Future2021 theme, in the content tab, below the primary image selection box, there should be a toggle button to select whether to display it or not.
In this theme, the option to display the primary image is in the default template, so it will be available for all pages, not just blog item pages.

I‘m using the latest version installed via the grav admin plugin page. But it seems that’s then not referring to the latest version?

@Thorben, It’s true. This option to display the image has already been in the development branch of the theme for a few weeks, but I haven’t published the next version. Sorry for this mishap.
In the next few days I will release the new version. In the meantime you can try the development branch version.