1

In this html block:

{% block body %}
    <h1>All Pages</h1>

    <ul>
        {% for x in entries %}
            {% comment %} {% wik = 'mask/' + x + '.md' %} {% endcomment %}
            <li><a href = 'mask/'{{x}} </a>{{ x }}</li>
        {% endfor %}
    </ul>

{% endblock %}

I am trying to insert a string in x that will go to end of the hypertext. mask/cat, where "cat" is x [just as an example]. When I do this, the entry does not seem to be added to the hyperlink when I click it.

The other way I thought is to create a python variable wik with the correct page hyperlink, but then I get an issue in Django

Invalid block tag on line 12: 'wik', expected 'empty' or 'endfor'. Did you forget to register or load this tag?

Any help appreciated thanks

2

1 Answer 1

2

Your problem here is that your variable is outside of the href, this should work:

<li><a href = 'mask/{{x}}' </a>{{ x }}</li>

If it's a variable based url on your app though, I would consider using a url pattern for a cleaner solution

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, @Danielle! I'll take a look at thay

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.