filtered homepage posts, template post_list changes

This commit is contained in:
Vicky Steeves 2017-05-07 12:15:57 -04:00
parent 6f03f1b68d
commit 4c15bc7ece
12 changed files with 425 additions and 21 deletions

View File

@ -451,7 +451,7 @@ HIDDEN_AUTHORS = ['Guest']
# Final location for the main blog page and sibling paginated pages is
# output / TRANSLATION[lang] / INDEX_PATH / index-*.html
INDEX_PATH = ""
INDEX_PATH = "public/pages/index/"
# Optional HTML that displayed on “main” blog index.html files.
# May be used for a greeting. (translatable)

13
pages/index.rst Normal file
View File

@ -0,0 +1,13 @@
.. title:
.. slug: index
.. date: 2017-01-06 14:24:09 UTC-05:00
.. tags:
.. category:
.. link:
.. description:
.. type: text
.. hidetitle: True
.. post-list::
:sections: updates

View File

@ -1,13 +1,14 @@
<!--
.. title: Announcing LISSA + COS
.. slug: cos-lissa
.. date: 2017-05-01 14:08:25 UTC-04:00
.. tags:
.. date: 2017-05-05 14:08:25 UTC-04:00
.. tags:
.. category:
.. link:
.. description:
.. type: text
-->
<!DOCTYPE html>
<html lang="en">
<body>

View File

@ -1,18 +1,19 @@
<!--
.. title: Coming Soon
.. slug: coming-soon
.. date: 2017-05-04 14:08:25 UTC-04:00
.. tags:
.. category:
.. date: 2017-05-05 14:08:25 UTC-04:00
.. tags:
.. category:
.. link:
.. description:
.. type: text
-->
<!DOCTYPE html>
<html lang="en">
<body>
<p>This will be a feed of new scholarship added to <a href="https://osf.io/preprints/lissa">LISSA</a>. You will be able to add materials during the soft launch, coming soon!</p>
<p>This page will be propagated by an RSS feed of new materials in <a href="https://osf.io/preprints/lissa">LISSA</a>. Check back during our soft launch to see what's being added!</p>
</body>
</html>

View File

@ -186,3 +186,58 @@ fieldset[disabled] .btn-default.focus {
color: #9c7eaf;
background-color: #ffffff;
}
/* --------------------TAGS--------------------------*/
#index-tags {
text-align:left;
font-size:1.1em;
}
#index-tags li {
background-color: transparent;
}
#index-tags li a {
font-weight: normal;
color: #8966a0;
font-size:1.5em;
text-decoration: underline;
}
/* --------------------TAGS LIST--------------------------*/
.list-tags {
text-align:left;
font-size:1.3em;
}
.list-tags li {
background-color: transparent;
}
.list-tags li a {
font-weight: normal;
color: #8966a0;
font-size:1.5em;
text-decoration: underline;
}
/* --------------------PAGINATION--------------------------*/
.pager li > a, .pager li > span{
display: inline-block;
padding: 5px 14px;
background-color: #8966a0;
border: 1px solid transparent;
border-radius: 15px;
}
.pager li > a:hover, .pager li > a:focus {
background-color: #563f65;
text-decoration: none;
}
/* --------------------POST LIST--------------------------*/
.post-list .list-unstyled > .post-list-item > h2 > a {
text-decoration:none;
}

View File

@ -1,7 +1,6 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="index_helper.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%namespace name="pagination" file="pagination_helper.tmpl"/>
<%inherit file="base.tmpl"/>
<%block name="extra_head">
@ -12,27 +11,20 @@
</%block>
<%block name="content">
<%block name="content_header"></%block>
% if 'main_index' in pagekind:
${front_index_header}
% endif
% if page_links:
${pagination.page_navigation(current_page, page_links, prevlink, nextlink, prev_next_links_reversed)}
% endif
<div class="postindex">
% for post in posts:
<article class="h-entry post-${post.meta('type')}">
<header>
<h1 class="p-name entry-title"><a href="${post.permalink()}" class="u-url">${post.title()|h}</a></h1>
<h1 class="p-name entry-title"><a href="${post.meta('link')}" class="u-url">${post.title()|h}</a></h1>
<div class="metadata">
<p class="byline author vcard"><span class="byline-name fn" itemprop="author">
% if author_pages_generated:
<a href="${_link('author', post.author())}">${post.author()|h}</a>
% else:
<a href="/who-we-are/">${post.author()|h}</a>
% endif
</span></p>
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></a></p>
% if not post.meta('nocomments') and site_has_comments:
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></a></p>
<p><a href="mailto:?subject=I saw this and thought of you!&body=${post.title()}; ${post.meta('link')}" onclick="ga('send', 'social', 'email', 'share', ${post.meta('link')}); return true;">Email this article</a></p>
<p><a href="https://twitter.com/share?url=${post.permalink()});text=${post.title()}, ${post.meta('link')}" onclick="ga('send', 'social', 'Twitter', 'tweet', ${post.permalink()}); return true;" target="_blank">Tweet this article</a></p>
% if not post.meta('nocomments') and site_has_comments:
<p class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif
</div>
@ -44,6 +36,16 @@
<div class="e-content entry-content">
${post.text(teaser_only=False)}
%endif
% if post.tags:
<div id="index-tags"
<ul class="tags">
Tagged:
%for tag in post.tags:
<li class="tag"><a href="${_link('tag', tag, lang)}">${tag}</a></li>
%endfor
</ul>
</div>
% endif
</div>
</article>
% endfor

View File

@ -0,0 +1,40 @@
## -*- coding: utf-8 -*-
<%def name="html_pager()">
%if prevlink or nextlink:
<nav class="postindexpager">
<ul class="pager">
%if prevlink:
<li class="previous">
<a href="${prevlink}" rel="prev">${messages("Newer posts")}</a>
</li>
%endif
%if nextlink:
<li class="next">
<a href="${nextlink}" rel="next">${messages("Older posts")}</a>
</li>
%endif
</ul>
</nav>
%endif
</%def>
<%def name="mathjax_script(posts)">
%if any(post.is_mathjax for post in posts):
%if use_katex:
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/katex.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.5.1/contrib/auto-render.min.js"></script>
<script>
renderMathInElement(document.body);
</script>
%else:
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
%endif
</%def>

View File

@ -0,0 +1,59 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="pheader" file="post_header.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%inherit file="base.tmpl"/>
<%block name="extra_head">
${parent.extra_head()}
% if post.meta('keywords'):
<meta name="keywords" content="${post.meta('keywords')|h}">
% endif
%if post.description():
<meta name="description" itemprop="description" content="${post.description()|h}">
%endif
<meta name="author" content="${post.author()|h}">
%if post.prev_post:
<link rel="prev" href="${post.prev_post.permalink()}" title="${post.prev_post.title()|h}" type="text/html">
%endif
%if post.next_post:
<link rel="next" href="${post.next_post.permalink()}" title="${post.next_post.title()|h}" type="text/html">
%endif
% if post.is_draft:
<meta name="robots" content="noindex">
% endif
${helper.open_graph_metadata(post)}
${helper.twitter_card_information(post)}
${helper.meta_translations(post)}
</%block>
<%block name="content">
<article class="post-${post.meta('type')} h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article">
${pheader.html_post_header()}
<div class="e-content entry-content" itemprop="articleBody text">
${post.text()}
</div>
<aside class="postpromonav">
<nav>
${helper.html_tags(post)}
${helper.html_pager(post)}
</nav>
</aside>
% if not post.meta('nocomments') and site_has_comments:
<section class="comments hidden-print">
<h2>${messages("Comments")}</h2>
${comments.comment_form(post.permalink(absolute=True), post.title(), post._base_path)}
</section>
% endif
${helper.mathjax_script(post)}
</article>
${comments.comment_link_script()}
</%block>
<%block name="sourcelink">
% if show_sourcelink:
<li>
<a href="${post.source_link()}" id="sourcelink">${messages("Source")}</a>
</li>
% endif
</%block>

View File

@ -0,0 +1,52 @@
## -*- coding: utf-8 -*-
<%namespace name="helper" file="post_helper.tmpl"/>
<%namespace name="comments" file="comments_helper.tmpl"/>
<%def name="html_title()">
%if title and not post.meta('hidetitle'):
<h1 class="p-name entry-title" itemprop="headline name"><a href="${post.meta('link')}" class="u-url">${post.title()|h}</a></h1>
%endif
</%def>
<%def name="html_translations(post)">
% if len(post.translated_to) > 1:
<div class="metadata posttranslations translations">
<h3 class="posttranslations-intro">${messages("Also available in:")}</h3>
% for langname in sorted(translations):
% if langname != lang and post.is_translation_available(langname):
<p><a href="${post.permalink(langname)}" rel="alternate" hreflang="${langname}">${messages("LANGUAGE", langname)}</a></p>
% endif
% endfor
</div>
% endif
</%def>
<%def name="html_sourcelink()">
% if show_sourcelink:
<p class="sourceline"><a href="${post.source_link()}" id="sourcelink">${messages("Source")}</a></p>
% endif
</%def>
<%def name="html_post_header()">
<header>
${html_title()}
<div class="metadata">
<p class="byline author vcard"><span class="byline-name fn">
% if author_pages_generated:
<a href="${_link('author', post.author())}">${post.author()|h}</a>
% else:
<a href="../../who-we-are">${post.author()|h}</a>
% endif
</span></p>
<p class="dateline"><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.formatted_date('webiso')}" itemprop="datePublished" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></a></p>
% if not post.meta('nocomments') and site_has_comments:
<p class="commentline">${comments.comment_link(post.permalink(), post._base_path)}
% endif
${html_sourcelink()}
%if post.description():
<meta name="description" itemprop="description" content="${post.description()|h}">
%endif
</div>
${html_translations(post)}
</header>
</%def>

View File

@ -0,0 +1,116 @@
## -*- coding: utf-8 -*-
<%def name="meta_translations(post)">
%if len(translations) > 1:
%for langname in sorted(translations):
%if langname != lang and ((not post.skip_untranslated) or post.is_translation_available(langname)):
<link rel="alternate" hreflang="${langname}" href="${post.permalink(langname)}">
%endif
%endfor
%endif
</%def>
<%def name="html_tags(post)">
%if post.tags:
<ul itemprop="keywords" class="tags">
%for tag in post.tags:
% if tag not in hidden_tags:
<li><a class="tag p-category" href="${_link('tag', tag)}" rel="tag">${tag|h}</a></li>
% endif
%endfor
</ul>
%endif
</%def>
<%def name="html_pager(post)">
%if post.prev_post or post.next_post:
<ul class="pager hidden-print">
%if post.prev_post:
<li class="previous">
<a href="${post.prev_post.permalink()}" rel="prev" title="${post.prev_post.title()|h}">${messages("Previous post")}</a>
</li>
%endif
%if post.next_post:
<li class="next">
<a href="${post.next_post.permalink()}" rel="next" title="${post.next_post.title()|h}">${messages("Next post")}</a>
</li>
%endif
</ul>
%endif
</%def>
<%def name="open_graph_metadata(post)">
%if use_open_graph:
<meta property="og:site_name" content="${blog_title|h}">
<meta property="og:title" content="${post.title()[:70]|h}">
<meta property="og:url" content="${abs_link(permalink)}">
%if post.description():
<meta property="og:description" content="${post.description()[:200]|h}">
%else:
<meta property="og:description" content="${post.text(strip_html=True)[:200]|h}">
%endif
%if post.previewimage:
<meta property="og:image" content="${url_replacer(permalink, post.previewimage, lang, 'absolute')}">
%endif
<meta property="og:type" content="article">
### Will only work with Pintrest and breaks everywhere else who expect a [Facebook] URI.
### %if post.author():
### <meta property="article:author" content="${post.author()|h}">
### %endif
%if post.date.isoformat():
<meta property="article:published_time" content="${post.formatted_date('webiso')}">
%endif
%if post.tags:
%for tag in post.tags:
<meta property="article:tag" content="${tag|h}">
%endfor
%endif
%endif
</%def>
<%def name="twitter_card_information(post)">
%if twitter_card and twitter_card['use_twitter_cards']:
<meta name="twitter:card" content="${twitter_card.get('card', 'summary')|h}">
%if 'site:id' in twitter_card:
<meta name="twitter:site:id" content="${twitter_card['site:id']}">
%elif 'site' in twitter_card:
<meta name="twitter:site" content="${twitter_card['site']}">
%endif
%if 'creator:id' in twitter_card:
<meta name="twitter:creator:id" content="${twitter_card['creator:id']}">
%elif 'creator' in twitter_card:
<meta name="twitter:creator" content="${twitter_card['creator']}">
%endif
%endif
</%def>
<%def name="mathjax_script(post)">
%if post.is_mathjax:
%if use_katex:
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/katex.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.6.0/contrib/auto-render.min.js"></script>
% if katex_auto_render:
<script>
renderMathInElement(document.body,
{
${katex_auto_render}
}
);
</script>
% else:
<script>
renderMathInElement(document.body);
</script>
% endif
%else:
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
%endif
</%def>

View File

@ -0,0 +1,28 @@
## -*- coding: utf-8 -*-
<%block name="content">
<!-- Begin post-list ${post_list_id} -->
<div id="${post_list_id}" class="post-list">
%if posts:
<ul class="post-list list-unstyled">
% for post in posts:
<li class="post-list-item">
<h1><a href="${post.permalink(lang)}">${post.title(lang)|h}</a></h1><p class="dateline">
<div class="metadata">
<p><a href="${post.permalink()}" rel="bookmark"><time class="published dt-published" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></a></p>
<p><a href="mailto:?subject=I saw this and thought of you!&body=${post.title()}; ${post.meta('link')}" onclick="ga('send', 'social', 'email', 'share', ${post.meta('link')}); return true;">Email this post</a></p>
<p><a href="https://twitter.com/share?url=${post.permalink()});text=${post.title()}, ${post.meta('link')}" onclick="ga('send', 'social', 'Twitter', 'tweet', ${post.permalink()}); return true;" target="_blank">Tweet this post</a></p>
</div>
%if index_teasers:
<div class="p-summary entry-summary">
${post.text(teaser_only=True)}
%else:
<div class="e-content entry-content">
${post.text(teaser_only=False)}
%endif
</li>
% endfor
</ul>
%endif
</div>
<!-- End post-list ${post_list_id} -->
</%block>

View File

@ -0,0 +1,37 @@
## -*- coding: utf-8 -*-
<%inherit file="base.tmpl"/>
<%block name="content">
% if cat_items:
% if items:
<h2>${messages("Categories")}</h2>
% endif
% for text, full_name, path, link, indent_levels, indent_change_before, indent_change_after in cat_hierarchy:
% for i in range(indent_change_before):
<ul class="list-inline">
% endfor
<li><a class="list-tags" href="${link}">${text|h}</a>
% if indent_change_after <= 0:
</li>
% endif
% for i in range(-indent_change_after):
</ul>
% if i + 1 < len(indent_levels):
</li>
% endif
% endfor
% endfor
% if items:
<h2>${messages("Tags")}</h2>
% endif
%endif
% if items:
<ul class="list-inline">
% for text, link in items:
% if text not in hidden_tags:
<li><a class="list-tags" href="${link}">${text|h}</a></li>
% endif
% endfor
</ul>
% endif
</%block>