Templates

During its execution, TubePress relies on a set of Twig templates to produce its final HTML. A TubePress theme may contain templates that TubePress will use instead of its defaults, thereby giving you full control of the HTML structure TubePress's output.

During its execution, TubePress relies on a set of Twig templates to produce its final HTML. A TubePress theme may contain templates that TubePress will use instead of its defaults, thereby giving you full control of the HTML structure TubePress's output.

Note

If you only want to change the style of TubePress's output, you probably don't need to bother with editing templates. Instead, try to utilize CSS in a theme. Templates control the structure of the final HTML, which doesn't need to change as often.

Logical Template Names

TubePress uses a handful of templates, each identified uniquely by a logical name. The following table lists the logical name of each template, along with a description of where it's used.

Logical Template Name Used for ...
css/scripts JavaScript tags and inline JavaScript that TubePress produces. This will end up either in the HTML <head> or right before the closing </body> tag.
css/styles CSS tags and inline CSS that TubePress produces. This will end up in the HTML <head>.
exception/ajax Returning an error message after a TubePress Ajax operation fails.
exception/static Displaying an error message to the user when TubePress hits an unrecoverable error.
gallery/players/<player>/ajax Returning HTML to be displayed to the user after a thumbnail is clicked. Replace <player> with the name of any TubePress player location name (e.g. shadowbox).
gallery/players/<player>/static Returning HTML, to be displayed along with the initial load of thumbnails, that contains the embedded video. Replace <player> with the name of any TubePress player location name (e.g. shadowbox).
gallery/main Arguably the most important template. Controls overall layout of video galleries and thumbnails.
gallery/pagination Clickable page numbers for galleries that span multiple pages.
search/input Interactive search input text field and button.
search/ajax-input Ajax-enabled interactive search input text field and button.
single/main Single video embeds.

Template Selection Process

Each logical template name must be converted to an actual template file on your web server. TubePress uses the following search procedure to accomplish this task.

  1. Check active theme
     

    First TubePress looks for a directory named templates at the root directory of the active theme. If this directory exists, TubePress looks inside for a template with the relative (from the templates directory) filesystem path of <logical-template-name>.html.twig. If a file at that path is found, TubePress will use this given template and the search ends here.

    For instance, given the logical template name gallery/pagination, TubePress would look inside the active theme directory for a file at templates/gallery/pagination.html.twig.
     

  2. Check parent theme
     

    If the active theme has a parent theme, Step 1 is repeated with the parent theme. This is a recursive process, so TubePress will search up the entire theme hierarchy until there are no more theme parents to check. If the template is still not found, TubePress goes on to Step 3.
     

  3. Revert to default, internal template
     

    If the previous steps fail to locate a template file on the filesystem, TubePress will revert to a default, internal template to produce the HTML.
     

Editing Templates

If you'd like to make changes to a template, we strongly recommend that you first read Twig's excellent template documentation. This will guide you through the entire process of editing a template.

Twig templates are compiled and cached on the filesystem for maximum performance. If you add, remove, or edit a template file, you will need to clear the TubePress system cache before you see the changes live on your site.



Last Updated Feb 17, 2016 05:28PM PST
c65861bf7a72e1a8878bdf73cabbbdbf@tubepress.desk-mail.com
http://assets0.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete