Last active
April 4, 2017 21:39
-
-
Save Archie22is/012ed588d7c5a72b7328 to your computer and use it in GitHub Desktop.
HubSpot HubL - Display a Featured blog post (using a topic or category)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="blog-section"> | |
<div class="blog-listing-outer-wrapper cell-wrapper"> | |
<div class="featured-blog-section"> | |
<div class="feat-blog-listing-wrapper cell-wrapper"> | |
{# simple_list_page indicates the "blog/all" page, which is a list of links to every blog post #} | |
<!-- blog post --> | |
{% for content in contents %} | |
{% if not simple_list_page %} | |
<!-- Featured Blog Post --> | |
<div class="post-item"> | |
{% if blog_author %} | |
<div class="hs-author-profile"> | |
<h2 class="hs-author-name">{{ blog_author.display_name }}</h2> | |
{% if blog_author.avatar %} | |
<div class="hs-author-avatar"> | |
<img src="{{ blog_author.avatar }}"> | |
</div> | |
{% endif %} | |
<div class="hs-author-bio">{{ blog_author.bio }}</div> | |
{% if blog_author.has_social_profiles %} | |
<div class="hs-author-social-section"> | |
<span class="hs-author-social-label">Find me on:</span> | |
<div class="hs-author-social-links"> | |
{% if blog_author.facebook %} | |
<a href="{{ blog_author.facebook }}" target="_blank" class="hs-author-social-link hs-social-facebook"> </a> | |
{% endif %} | |
{% if blog_author.linkedin %} | |
<a href="{{ blog_author.linkedin }}" target="_blank" class="hs-author-social-link hs-social-linkedin"> </a> | |
{% endif %} | |
{% if blog_author.twitter %} | |
<a href="{{ blog_author.twitter }}" target="_blank" class="hs-author-social-link hs-social-twitter"> </a> | |
{% endif %} | |
{% if blog_author.google_plus %} | |
<a href="{{ blog_author.google_plus }}?rel=author" target="_blank" class="hs-author-social-link hs-social-google-plus"> </a> | |
{% endif %} | |
</div> | |
</div> | |
{% endif %} | |
</div> | |
{% endif %} | |
<!-- The magic starts here --> | |
<!-- Developer: Archie Makuwa --> | |
<!-- Sometime in 2015 --> | |
<!-- In this case the "Featured" topuc is responsive for the filter --> | |
{% set topic_posts = blog_recent_topic_posts('default', 'featured', 1) %} | |
{% for topic_post in topic_posts %} | |
<!-- Blog Post Content --> | |
<div class="blogpost-content"> | |
<div class="post-header"> | |
<h1>{{ topic_post.name }}</h1> | |
</div> | |
<div class="post-body clearfix"> | |
{{ topic_post.post_list_content|safe|truncatehtml(220) }} | |
</div> | |
<div id="hubspot-author_data" class="hubspot-editable" data-hubspot-form-id="author_data" data-hubspot-name="Blog Author"> | |
<p>Posted by | |
{%if topic_post.blog_post_author %} | |
{{ topic_post.blog_post_author.display_name }} - {{ topic_post.publish_date|datetimeformat('%d %B %Y') }} | |
{% endif %} | |
</p> | |
</div> | |
{% if content_group.show_summary_in_listing %} | |
<a class="more-link" href="{{ topic_post.absolute_url }}">Read More...</a> | |
{% endif %} | |
</div> | |
<!-- Blog post featured image --> | |
<div class="blogpost-feat-img{% if simple_list_page %}-simple{% endif %}" style="background: url('{{ topic_post.post_list_summary_featured_image }}')";> | |
<!-- Nothing to see here --> | |
</div> | |
{% endfor %} | |
{% endif %} | |
</div> | |
{% endfor %} | |
</div> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment