{# -------------------------------------------------------------------------- #} {# -------------------------------------------------------------------------- #} {# META #} {#: The basic meta tag :#} {% macro meta_tag(name, value) %} {% endmacro %} {#: Custom meta tag :#} {% macro meta_custom(namespace, name, value) %} {% endmacro %} {#: opengraph property :#} {% macro meta_property(namespace, name, value) %} {% endmacro %} {#: opengraph tag :#} {% macro meta_opengraph(name, value) %} {% if value %} {% endif %} {% endmacro %} {#: Custom meta tag :#} {% macro meta_googleplus(name, value) %} {% if value %} {% endif %} {% endmacro %} {#: Custom meta tag :#} {% macro meta_twitter(name, value) %} {% if value %} {% endif %} {% endmacro %} {# -------------------------------------------------------------------------- #} {#: Page meta_social_graph :#} {% macro meta_social_graph() %} {% set url = site.base_url + page.url %} {{ meta_opengraph("title", page.title or '') }} {{ meta_opengraph("description", page.description or '') }} {{ meta_opengraph("url", url) }} {{ meta_opengraph("site_name", site.name or '') }} {{ meta_opengraph("type", page.meta.object_type or 'article') }} {{ meta_googleplus("description", page.description or '' ) }} {{ meta_googleplus("name", page.title or '') }} {{ meta_googleplus("url", url) }} {{ meta_twitter("title", page.title or '') }} {{ meta_twitter("description", page.description or '') }} {{ meta_twitter("url", url ) }} {% if not page.image %} {{ meta_twitter("card", "summary") }} {% endif %} {% if page.image %} {{ meta_opengraph("image", page.image) }} {{ meta_googleplus("image", page.image) }} {{ meta_twitter("image", page.image) }} {{ meta_twitter("card", "summary_large_image") }} {% endif %} {% endmacro %} {# -------------------------------------------------------------------------- #} {# Create the meta tags #} {% macro meta_tags() %} {% for k, v in page.meta.items() %} {{ meta_tag(k, v) }} {% endfor %} {% endmacro %} {# -------------------------------------------------------------------------- #} {# Create a page title #} {% macro meta_page_title(title=None, suffix=None, separator='|') %} {{ title or page.title or '' }} {{ separator }} {{ suffix or site.name }} {{ meta_tag('title', title or page.title or '') }} {% endmacro %} {# -------------------------------------------------------------------------- #} {# Create page description #} {% macro meta_page_description(description=None) %} {{ meta_tag('description', description or page.description or site.description or '') }} {% endmacro %} {# -------------------------------------------------------------------------- #} {# Create a CSS stylesheet #} {% macro css(src) %} {% assets src %} {% endassets %} {% endmacro %} {# -------------------------------------------------------------------------- #} {#: JS :#} {% macro js(src) %} {% assets src %} {% endassets %} {% endmacro %} {# -------------------------------------------------------------------------- #} {#: IMAGE :#} {% macro image(src, class="", id="") %} {% assets src %} {% endassets %} {% endmacro %} {# -------------------------------------------------------------------------- #} {#: FAVICON :#} {% macro favicon(path) %} {% assets src %} {% endassets %} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro google_analytics(code=None) %} {% if not code %} {% set code = site.google_analytics %} {% endif %} {% if code %} {% endif %} {% endmacro %} {# -------------------------------------------------------------------------- #} {# PAGE_TOC: Table of Contents. It will include the TOC on the page #} {% macro page_toc() %} {{ page.__toc__ }} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro timeago(dt, format="MM/DD/YYYY h:mm a") %} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro datetime(dt, format="MM/DD/YYYY h:mm a") %} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro year() %} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro current_year() %} {% endmacro %} {# -------------------------------------------------------------------------- #} {# Creates a link to a page page: the name, ie: index.jade text: the text to create the link. If empty, it will use the link original text title: the link title. class: a class id: id #} {% macro link_to(page, text=None, title=None, class="", id="") %} {{ page | yass_link_to(text=text, title=title, _class=class, id=id) | safe }} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro url_to(page) %} {{ page | yass_url_to }} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro static_link(src, text, title=None, class="", id="") %} {% assets src %} {{ text | safe}} {% endassets %} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro static_url(src) %} {%- assets src %} {{ ASSET_URL }} {% endassets -%} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro include(file) %} {% include file %} {% endmacro %} {# -------------------------------------------------------------------------- #} {% macro embed(url, witdh="100%", height="480", class="", id="") %} {% endmacro %} {# paginator :prev: Text for previous button :next: Text for Next button :class: A class name for pagination if customed. If you are extending the class best to add the original class and your custom class ie: 'pagination my_custom_pagination' or 'pager my_custom_page' :pager: If true it will show a pager instead of numbered pagination :mobile: if True, if will show the pagination into a 'pager' #} {% macro paginator(prev="Prev", next="Next", class=None, pager=False, mobile=True) %} {% if mobile %} {% else %} {{ _pagination(prev, next, class, pager, **kwargs) }} {% endif %} {% endmacro %} {%- macro _pagination_page_url(page_num) -%} {{- page.paginator.slug | replace("{page_num}", page_num) | safe -}} {%- endmacro -%} {% macro _pagination(prev="", next="", class=None, pager=False) %} {{ kwargs }} {% if not class %} {% set class = "pagination" %} {% if pager %} {% set class = "pager" %} {% endif %} {% endif %} {% set _prev_btn = " %s" % prev %} {% set _next_btn = "%s " % next %} {% endmacro %}