我使用的是Django,但出于某种原因,<h2>
标签可以毫无问题地显示article.title
,但是<p>
标签不会显示任何内容-即使是简单的文本。
{% extends 'base_layout.html' %}
{% block content%}
<h1>Articles List</h1>
<div class="articles">
{% for article in articles %}
<div class="article">
<h2><a href="{% url 'articles:detail' slug=article.slug %}">{{ article.title}}</a></h2>
<p>TEST TEXT</p>
<p>{{ article.date }}</p>
</div>
{% endfor %}
</div>
{% endblock %}
base_layout.html
是
{% load static from staticfiles %}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Carpe Nocturn</title>
<link rel="stylesheet" href="{% static 'styles.css' %}">
</head>
<body>
<header class="wrapper">
<h1><a href="{% url 'articles:list' %}"><img src="{% static 'logo.png' %}" alt="Carpe Nocturn" /></a></h1>
</header>
<div class="wrapper">
{% block content %}
{% endblock %}
</div>
</body>
</html>