Hi,
I have created a content type where i use the image field - images are displayed as image gallery. However the default image field does not contain the caption. could you please let me know how to add and display the caption of a image?
thanks,
Joao
Hi Joao,
Please provide some more details such as the name of the website and what module did you use for the gallery.
Hello Joao,
This is an unfortunate part of Drupal 8 since this functionality does not exist neither in the core nor in a contributed module as it used to for D7 websites.
However adding this functionality to your content type is not very complicated. In order to avoid duplicating content I found a medium tutorial article on how to do it. Read the article and on top of that I will mention some general steps that you should follow:
- If you are using the CERN Theme, install the CERN Override theme
- Create a separate text field in the Content type to hold the caption
- Create a template to override the image field of this content type and make it include the caption within the figure like it is described in the tutorial.
- The template needs to be stored in a file under the
/templates
files - Pay extra attention in the naming of the template since Drupal is case sensitive when it comes to theme templates.
- Also make sure to clear the caches every time you make a change in the template since Drupal automatically caches the templates.
I guess thats all. If you have more questions feel free to post it here.
Konstantinos