You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/common/templates.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -125,6 +125,33 @@ If the request url is https://localhost:8000/ and there are these files:
125
125
</ul>
126
126
```
127
127
128
+
**Exclude a slug from being included**
129
+
130
+
If the request url is https://localhost:8000/ and there are these files:
131
+
132
+
- content/articles/article1.md
133
+
- content/articles/article2.md
134
+
135
+
```markdown
136
+
# Articles
137
+
138
+
{% directory_contents "articles" exclude="article1" as directory_contents %}
139
+
140
+
{% for content in directory_contents %}
141
+
142
+
- {{ content.slug }}
143
+
144
+
{% endfor %}
145
+
```
146
+
147
+
```html
148
+
<h1id="articles">Articles</h1>
149
+
150
+
<ul>
151
+
<li>article2</li>
152
+
</ul>
153
+
```
154
+
128
155
#### `include_md`
129
156
130
157
Similar to the [`include`](https://docs.djangoproject.com/en/stable/ref/templates/builtins/#include) template tag, but can be used to include a markdown file and have it render correctly into HTML. It can be used in markdown files or in HTML templates.
0 commit comments