Integration¶
Linking¶
Django templates can link to coltrane
markdown content with the url
template tag and the slug of the markdown file.
<!-- this will link to a route which renders the /content/about.md markdown file -->
<a href="{% url 'coltrane:content' 'about' %}">About</a>
Sitemap¶
Add
"django.contrib.sitemaps",
toINSTALLED_APPS
in the settings fileMake sure your
TEMPLATES
setting contains aDjangoTemplates
backend whoseAPP_DIRS
options is set toTrue
.Add the following to
urls.py
from django.contrib.sitemaps.views import sitemap
from coltrane.sitemaps import ContentSitemap
# Make sure that the protocol is https
ContentSitemap.protocol = "https"
sitemaps = {
"content": ContentSitemap,
}
urlpatterns = [
# other URL paths here
path(
"sitemap.xml",
sitemap,
{"sitemaps": sitemaps},
name="django.contrib.sitemaps.views.sitemap",
),
# other URL paths here
]
More details are in the Django documentation for sitemaps.
RSS¶
RSS requires an absolute URL so coltrane
needs to know the domain for the site. The settings file needs to include something similar to the following.
COLTRANE = {
"SITE_URL": "https://example.com",
}
URL Routing¶
Add the following to
urls.py
from django.urls import path
from coltrane.feeds import ContentFeed
urlpatterns = [
path("rss.xml", ContentFeed()),
]