Skip to content

Commit

Permalink
started life broadcasting post
Browse files Browse the repository at this point in the history
added support for post drafts
  • Loading branch information
d093w1z committed Aug 27, 2024
1 parent 4e0e0bf commit 5d88ad4
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 114 deletions.
25 changes: 22 additions & 3 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
plugins: ["@shopify/prettier-plugin-liquid"]
printWidth: 150
trailingComma: "es5"
{
"plugins": ["@shopify/prettier-plugin-liquid"],
"tabWidth": 2,
"useTabs": false,
"printWidth": 80,
"singleQuote": true,
"trailingComma": "es5",
"bracketSpacing": true,
"proseWrap": "preserve",
"htmlWhitespaceSensitivity": "css",
"semi": true,
"arrowParens": "avoid",

"overrides": [
{
"files": "*.md",
"options": {
"embeddedLanguageFormatting": "auto"
}
}
]
}
227 changes: 116 additions & 111 deletions _pages/blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ title: blog
nav: true
nav_order: 1
pagination:
enabled: true
collection: posts
permalink: /page/:num/
per_page: 5
sort_field: date
sort_reverse: true
trail:
before: 1 # The number of links before the current page
after: 3 # The number of links after the current page
enabled: true
collection: posts
permalink: /page/:num/
per_page: 5
sort_field: date
sort_reverse: true
trail:
before: 1 # The number of links before the current page
after: 3 # The number of links after the current page
---

<div class="post">
Expand All @@ -34,23 +34,25 @@ pagination:
<div class="tag-category-list">
<ul class="p-0 m-0">
{% for tag in site.display_tags %}
<li>
<i class="fa-solid fa-hashtag fa-sm"></i> <a href="{{ tag | slugify | prepend: '/blog/tag/' | relative_url }}">{{ tag }}</a>
</li>
{% unless forloop.last %}
<p>&bull;</p>
{% endunless %}
<li>
<i class="fa-solid fa-hashtag fa-sm"></i> <a
href="{{ tag | slugify | prepend: '/blog/tag/' | relative_url }}">{{ tag }}</a>
</li>
{% unless forloop.last %}
<p>&bull;</p>
{% endunless %}
{% endfor %}
{% if site.display_categories.size > 0 and site.display_tags.size > 0 %}
<p>&bull;</p>
<p>&bull;</p>
{% endif %}
{% for category in site.display_categories %}
<li>
<i class="fa-solid fa-tag fa-sm"></i> <a href="{{ category | slugify | prepend: '/blog/category/' | relative_url }}">{{ category }}</a>
</li>
{% unless forloop.last %}
<p>&bull;</p>
{% endunless %}
<li>
<i class="fa-solid fa-tag fa-sm"></i> <a
href="{{ category | slugify | prepend: '/blog/category/' | relative_url }}">{{ category }}</a>
</li>
{% unless forloop.last %}
<p>&bull;</p>
{% endunless %}
{% endfor %}
</ul>
</div>
Expand All @@ -60,131 +62,134 @@ pagination:
{% if featured_posts.size > 0 %}
<br>

<div class="container featured-posts">
{% assign is_even = featured_posts.size | modulo: 2 %}
<div class="row row-cols-{% if featured_posts.size <= 2 or is_even == 0 %}2{% else %}3{% endif %}">
{% for post in featured_posts %}
<div class="col mb-4">
<a href="{{ post.url | relative_url }}">
<div class="card hoverable">
<div class="row g-0">
<div class="col-md-12">
<div class="card-body">
<div class="float-right">
<i class="fa-solid fa-thumbtack fa-xs"></i>
</div>
<h3 class="card-title text-lowercase">{{ post.title }}</h3>
<p class="card-text">{{ post.description }}</p>

{% if post.external_source == blank %}
{% assign read_time = post.content | number_of_words | divided_by: 180 | plus: 1 %}
{% else %}
{% assign read_time = post.feed_content | strip_html | number_of_words | divided_by: 180 | plus: 1 %}
{% endif %}
{% assign year = post.date | date: "%Y" %}

<p class="post-meta">
{{ read_time }} min read &nbsp; &middot; &nbsp;
<a href="{{ year | prepend: '/blog/' | prepend: site.baseurl}}">
<i class="fa-solid fa-calendar fa-sm"></i> {{ year }} </a>
</p>
<div class="container featured-posts">
{% assign is_even = featured_posts.size | modulo: 2 %}
<div class="row row-cols-{% if featured_posts.size <= 2 or is_even == 0 %}2{% else %}3{% endif %}">
{% for post in featured_posts %}
<div class="col mb-4">
<a href="{{ post.url | relative_url }}">
<div class="card hoverable">
<div class="row g-0">
<div class="col-md-12">
<div class="card-body">
<div class="float-right">
<i class="fa-solid fa-thumbtack fa-xs"></i>
</div>
<h3 class="card-title text-lowercase">{{ post.title }}</h3>
<p class="card-text">{{ post.description }}</p>

{% if post.external_source == blank %}
{% assign read_time = post.content | number_of_words | divided_by: 180 | plus: 1 %}
{% else %}
{% assign read_time = post.feed_content | strip_html | number_of_words | divided_by: 180 | plus: 1 %}
{% endif %}
{% assign year = post.date | date: "%Y" %}

<p class="post-meta">
{{ read_time }} min read &nbsp; &middot; &nbsp;
<a href="{{ year | prepend: '/blog/' | prepend: site.baseurl}}">
<i class="fa-solid fa-calendar fa-sm"></i> {{ year }} </a>
</p>
</div>
</div>
</div>
</a>
</div>
{% endfor %}
</div>
</a>
</div>
{% endfor %}
</div>
<hr>

</div>
<hr>

{% endif %}

<ul class="post-list">

{% if page.pagination.enabled %}
{% assign postlist = paginator.posts %}
{% assign postlist = paginator.posts | where_exp: "post", "post.draft != true" %}
{% else %}
{% assign postlist = site.posts %}
{% assign postlist = site.posts | where_exp: "post", "post.draft != true" %}
{% endif %}

{% for post in postlist %}

{% for post in postlist| where_exp: "post", "post.draft" %}

{% if post.external_source == blank %}
{% assign read_time = post.content | number_of_words | divided_by: 180 | plus: 1 %}
{% assign read_time = post.content | number_of_words | divided_by: 180 | plus: 1 %}
{% else %}
{% assign read_time = post.feed_content | strip_html | number_of_words | divided_by: 180 | plus: 1 %}
{% assign read_time = post.feed_content | strip_html | number_of_words | divided_by: 180 | plus: 1 %}
{% endif %}
{% assign year = post.date | date: "%Y" %}
{% assign tags = post.tags | join: "" %}
{% assign categories = post.categories | join: "" %}

<li>

{% if post.thumbnail %}
{% if post.thumbnail %}

<div class="row">
<div class="col-sm-9">
{% endif %}
<h3>
{% if post.redirect == blank %}
<a class="post-title" href="{{ post.url | relative_url }}">{{ post.title }}</a>
{% elsif post.redirect contains '://' %}
<a class="post-title" href="{{ post.redirect }}" target="_blank">{{ post.title }}</a>
<svg width="2rem" height="2rem" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
<path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#999" stroke-width="1.5" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
{% else %}
<a class="post-title" href="{{ post.redirect | relative_url }}">{{ post.title }}</a>
{% endif %}
</h3>
<p>{{ post.description }}</p>
<p class="post-meta">
{{ read_time }} min read &nbsp; &middot; &nbsp;
{{ post.date | date: '%B %d, %Y' }}
{% if post.external_source %}
&nbsp; &middot; &nbsp; {{ post.external_source }}
{% endif %}
</p>
<p class="post-tags">
<a href="{{ year | prepend: '/blog/' | prepend: site.baseurl}}">
<i class="fa-solid fa-calendar fa-sm"></i> {{ year }} </a>

{% if tags != "" %}
&nbsp; &middot; &nbsp;
<div class="row">
<div class="col-sm-9">
{% endif %}
<h3>
{% if post.redirect == blank %}
<a class="post-title" href="{{ post.url | relative_url }}">{{ post.title }}</a>
{% elsif post.redirect contains '://' %}
<a class="post-title" href="{{ post.redirect }}" target="_blank">{{ post.title }}</a>
<svg width="2rem" height="2rem" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
<path d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9" class="icon_svg-stroke" stroke="#999" stroke-width="1.5"
fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round"></path>
</svg>
{% else %}
<a class="post-title" href="{{ post.redirect | relative_url }}">{{ post.title }}</a>
{% endif %}
</h3>
<p>{{ post.description }}</p>
<p class="post-meta">
{{ read_time }} min read &nbsp; &middot; &nbsp;
{{ post.date | date: '%B %d, %Y' }}
{% if post.external_source %}
&nbsp; &middot; &nbsp; {{ post.external_source }}
{% endif %}
</p>
<p class="post-tags">
<a href="{{ year | prepend: '/blog/' | prepend: site.baseurl}}">
<i class="fa-solid fa-calendar fa-sm"></i> {{ year }} </a>

{% if tags != "" %}
&nbsp; &middot; &nbsp;
{% for tag in post.tags %}
<a href="{{ tag | slugify | prepend: '/blog/tag/' | prepend: site.baseurl}}">
<i class="fa-solid fa-hashtag fa-sm"></i> {{ tag }}</a>
{% unless forloop.last %}
&nbsp;
{% endunless %}
{% endfor %}
{% endif %}

{% if categories != "" %}
&nbsp; &middot; &nbsp;
{% unless forloop.last %}
&nbsp;
{% endunless %}
{% endfor %}
{% endif %}

{% if categories != "" %}
&nbsp; &middot; &nbsp;
{% for category in post.categories %}
<a href="{{ category | slugify | prepend: '/blog/category/' | prepend: site.baseurl}}">
<i class="fa-solid fa-tag fa-sm"></i> {{ category }}</a>
{% unless forloop.last %}
&nbsp;
{% endunless %}
{% endfor %}
{% endif %}
</p>
{% unless forloop.last %}
&nbsp;
{% endunless %}
{% endfor %}
{% endif %}
</p>

{% if post.thumbnail %}
{% if post.thumbnail %}

</div>
</div>

<div class="col-sm-3">
<img class="card-img" src="{{post.thumbnail | relative_url}}" style="object-fit: cover; height: 90%" alt="image">
</div>
</div>
{% endif %}
<div class="col-sm-3">
<img class="card-img" src="{{post.thumbnail | relative_url}}" style="object-fit: cover; height: 90%"
alt="image">
</div>
</div>
{% endif %}
</li>

{% endfor %}

</ul>
Expand Down
Loading

0 comments on commit 5d88ad4

Please sign in to comment.