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

include template function with arguments #5897

Closed
UweOhse opened this issue Oct 15, 2023 · 3 comments · Fixed by #5898
Closed

include template function with arguments #5897

UweOhse opened this issue Oct 15, 2023 · 3 comments · Fixed by #5898
Labels
documentation 📚 Improvements or additions to documentation

Comments

@UweOhse
Copy link

UweOhse commented Oct 15, 2023

The documentation for the include template function states:

  Includes the contents of another file and renders in-place.
  Optionally can pass key-value pairs as arguments to be accessed by the included file.

 {{include "path/to/file.html"}}  // no arguments
 {{include "path/to/file.html" "arg1" 2 "value 3"}}  // with arguments

How does one access these arguments?

@UweOhse
Copy link
Author

UweOhse commented Oct 15, 2023

You access "arg1" as ".Args 0", which wasn't what i expected when the example starts with 1.

Could you please change the example to start with "arg0", and add a link to .Args?

@francislavoie
Copy link
Member

Good point. #5898 should improve it 👍

@francislavoie francislavoie added the documentation 📚 Improvements or additions to documentation label Oct 15, 2023
@UweOhse
Copy link
Author

UweOhse commented Oct 16, 2023

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation 📚 Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants