Custom Page Template

The custom page template (or default template) controls the look of Vidcaster custom pages. Vidcaster sites have the ability to create custom pages within the Vidcaster Admin (Site > Pages). These pages can contain any HTML content you want. In Django language, these are 'flat pages.' Vidcaster flat pages have a few fields, some of which are customized from generic Django flat page structure. The Vidcaster flat page fields are:

  • Title
  • URL – this is the pathname of your custom page. You can add multiple directories into this URL, even if they don't actually exist.
  • Visibility – whether or not you want this page to show up in your navigation. If your base template uses {% get_public_pages as page_list %} as part of the navigation block, you must pay attention to this. If you hardcode your navigation however, this is of course irrelevant.
  • Content – the main area for the HTML content of the page.
  • Head Content – optional content inserted into the head tag.
  • End of Body Content – optional content inserted right before the end of the body tag.

The custom page template itself is pretty simple. It uses the elements detailed above, along with some wrapper divs to contain the content area. In order to create a super flexible custom page template, you can leave out wrapping divs. You could even get the custom page template to show a blank page by default, so you could create a custom page that looks completely different from the rest of your site (if you really wanted to).

Keep this in mind when designing your base template – include as much content as possible within blocks, so that you can eliminate unwanted content blocks from other templates such as the custom page template. Remember, unless content is contained within a block on the base template, you will automatically have to inherit it on all your sub-templates.

Below is an example of a full custom page template. The title and url are used for meta information. The content is the main content area. The headcontent and endbodycontent blocks are included to display scripts and CSS that a user may have included in a specific custom page.


{% extends "base.HTML" %}

{% block title %}{{ flatpage.title }} - {{ current_site.name }}{% endblock title %}
{% block bodyid %} id="{{ flatpage.url|cut:"/" }}"{% endblock bodyid %}
{% block bodyclass %} class="page"{% endblock bodyclass %}
{% block canonical %}<link rel="canonical" href="http://{{ current_site.domain }}/{{ flatpage.url|cut:'/' }}/" />{% endblock canonical %}
{% block headcontent %} {% if flatpage.flatpageextras.head_content %}{{ flatpage.flatpageextras.head_content|safe }}{% endif %} {% endblock %}
{% block content %}

	<div class="section">
		<div class="main-column">
			{{ flatpage.content }}
		</div>
	</div>
{% endblock content %}

{% block endbodycontent %} {% if flatpage.flatpageextras.endbody_content %}{{ flatpage.flatpageextras.endbody_content|safe }}{% endif %} {% endblock %}

 

Next section →