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 content without parsing it #425

Open
ranfdev opened this issue Jul 3, 2019 · 4 comments

Comments

@ranfdev
Copy link

commented Jul 3, 2019

Something like this https://tera.netlify.com/docs/templates/#include
but instead of parsing the content of the file as if it was a template, just include the raw content of the file.
Maybe a function like: include_raw.
Why? It's needed to be able to import html files from external tools such as ansi2html or https://git.sr.ht/~sircmpwn/openring.

@Keats

This comment has been minimized.

Copy link
Owner

commented Jul 4, 2019

Is there some precedent in Jinja2/Django?
As long as there isn't {{, {% etc in the template it should already work fine

@ranfdev

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

The problem is, i may work with user generated html files. A user may write {{ in the file and read other files on my system. That's a security issue. Manually escaping user input is really hard/impossible, so i hope this can be solved at a deeper level, inside tera

@Keats Keats added the enhancement label Jul 5, 2019

@Keats

This comment has been minimized.

Copy link
Owner

commented Jul 5, 2019

Where would the files be located? In the templates directory or would the tag/function have to load them from the filesystem first?

@ranfdev

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

Just to be clear about what i want to build:

  • I have a website (made with zola, which is awesome btw).
  • I want to create a section "read next" in the footer of my website, like this:
    image using https://git.sr.ht/~sircmpwn/openring.
  • the program openring works by fetching a list of rss feeds and putting a preview of the latest articles inside an output html file (let's say openring.html, inside the templates folder. If you want a better explanation of how openring works, checkout the website).
  • I now need to include the openring.html file inside my footer.

Problem: someone may put {{ on his blog, so in the file openring.html i have {{. I need to include openring.html without parsing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.