Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using fragments in a MultiContent template using Thymeleaf should not need the file extension #87

Open
aurelien-baudet opened this issue Nov 21, 2019 · 0 comments

Comments

@aurelien-baudet
Copy link
Member

Path to a fragment from a template must currently contain '.html' or '.txt' whereas Thymeleaf documentation doesn't use file extension when referencing to a fragment.

So Ogham should follow the same behavior and resource resolution should use variants too to search for fragments.

Steps to Reproduce

  1. Create a test that sends an email using a MultiTemplateContent:
    messagingService.send(new Email().content(new MultiTemplateContent("main.html")))...
  2. Create a fragment
    fragment/layout.html:
    <head th:fragment="header">
     <meta charset="utf-8" />
     <link th:href="@{css/layout.css}" rel="stylesheet" type="text/css" />
     <link th:href="@{css/common.css}" rel="stylesheet" type="text/css" />
    </head>
  3. Create a template that includes the fragment (main.html):
    <head th:replace="fragments/layout.html :: header"></head>

Current behavior:

Inclusion of fragment needs the file extension.
<head th:replace="fragments/layout.html :: header"></head>

Expected behavior:

Inclusion of fragment should not need the file extension.
<head th:replace="fragments/layout.html :: header"></head>

However, if file extension is explicitly provided, it should also work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant