Need help with how custom fields are displayed by article.html.twig file Noncoder here. After not poking my head under the hood of any CMS in years (not since Drupal 5, I think — and I wasn't very good at it even then), I'm working on a portfolio site. I suspect this question will be an easy one to answer for anyone with even modest coding experience; sadly, I can't claim to have even that.

This site will showcase previously published material, and it has to display the original publication date instead of the date that the content was added to the website. It also should display the name of the original publication.

I've created two fields for my article content type:


field_publicationdate
field_originalpublication


I would like the content to be displayed like this:


(Title field)
"Originally published in " (orginalpublication field) " on " (publicationdate field) [note: I'd like this to be consistent with the theme's custom date display format of 'F d, Y']
By (author)  (time to read)


It currently reads:


(Title field)
(date content was added to Drupal)    By (content creator)  (time to read)


I'm now in the node--article.html.twig file.

Someone who was helping me pointed me to lines 28 and 30 of the attached screencap, assuming I had enough basic knowledge to take it from there. While flattered in by this person's confidence in me, as I mentioned in my first paragraph, I'm an idiot when it comes to this stuff.

Can someone help?
If I understand correctly:

The node.createdtime in the screenshot comes from the content type setting "Display author and date information" on the content type edit page. Look at /admin/structure/types/manage/article.

If you need a different date shown, you can uncheck that setting to hide Drupal's author and date info display, then ensure your custom fields are displayed on the node instead. Look at /admin/structure/types/manage/article/display.

If the template node--article.html.twig renders content with just {{ content }}, your fields will show once set to display. If your template file is customized, you may need to add {{ content.field_publicationdate }}.

As @Kevin mentioned, use the field format options at /admin/structure/types/manage/article/display to control the output of your date field.



A more technical approach, and if your content is being imported, could be to map your field_publicationdate value to the node created time value. (But that's another question :)