- 🇫🇷France duaelfr Montpellier, France
The questions has been answered. Do not hesitate to reopen if needed.
Automatically closed - issue fixed for 2 weeks with no activity.
- Status changed to Fixed
over 1 year ago 4:01pm 10 February 2023 - 🇬🇧United Kingdom nigelwhite Marsden
Thank you for these ideas. [Coming back to this after a while, so sorry for the delay]
Two of your ideas worked for me. To summarize for any other site builders who are puzzled -
- fields you want to format with your pattern must be plain text or link. Even then Drupal will add a load of html markup around your field, which will throw your pattern's twig
- remove markup from all fields in your display as per #11. At the bottom of /admin/structure/types/manage/your-content-type/display you will find a Pattern Settings tab. Set Field Templates to 'Only content'.
- remove markup from fields individually by installing nomarkup module as per #12. Each field's settings cog has a 'Remove field markup' option
For links -
- in yml your link field is type 'uri'
- in pattern preview this worked for me: preview:
"<a href='https://example.com/'>Link to source</a>"
- in the twig a simple {{ your-field }} is all you need
- when adding content in the node add form the url and the link text are what you'd expect