Instead of writing out {% include link_to.html i=5 text="hello world" %}
all the time, I've written a custom tag that allows me to do {% link_to 5 hello world %}
. It finds the page with data i
equal to 5 and creates a link to it.
But it feels clunky to generate HTML strings from inside the tag code, and it is awkward to write complicated code logic inside the HTML include code. So is there a way to have the tag definition do the heavy lifting of finding the relevant page to link to, and have it pass on what it found to link_to.html
to render? Sort of like the controller passing information on to the view in Rails.