Skip to content

Commit

Permalink
feat: add first post template
Browse files Browse the repository at this point in the history
  • Loading branch information
bigbrozer committed May 24, 2023
1 parent 1e095b0 commit 964391b
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 275 deletions.
8 changes: 8 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,14 @@
"value": "f626eed9",
"type": "text"
},
{
"name": "postDefaultHeaderImageUrl",
"label": "Default post image URL",
"group": "Posts",
"note": "URL to an image shown when the post does not have a featured image.",
"value": "https://source.unsplash.com/0gkw_9fy0eQ",
"type": "text"
},
{
"name": "mainWidth",
"label": "Main width",
Expand Down
51 changes: 1 addition & 50 deletions index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -38,55 +38,6 @@
</div>
{{! /Portfolio }}

{{! Posts }}
<div class="uk-section">
<a id="readings"></a>

<div class="uk-container uk-dark" uk-scrollspy="cls: uk-animation-slide-right">
<h2 class="uk-heading-divider">Readings</h2>

<div class="uk-grid-small uk-child-width-1-2@m" uk-grid uk-height-match=".uk-card-body > p">
{{#each posts}}
{{#unless isHidden}}
{{#checkIf template '!=' "portfolio"}}
<div uk-scrollspy="cls: uk-animation-fade">
<div class="uk-card uk-card-secondary">
<div class="uk-cover-container uk-card-media-top">
{{#checkIfAll featuredImage featuredImage.urlMd}}
<img src="{{featuredImage.urlMd}}" alt="" uk-cover>
{{else}}
<img src="https://source.unsplash.com/0gkw_9fy0eQ" alt="typewriter" uk-cover>
{{/checkIfAll}}
<canvas width="300" height="300"></canvas>
</div>

<div class="uk-card-header">
<div class="uk-grid-small uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<img class="uk-border-circle" width="40" height="40" src="{{author.avatarImage.url}}" alt="Avatar">
</div>
<div class="uk-width-expand">
<h3 class="uk-card-title uk-margin-remove-bottom">{{title}}</h3>
<p class="uk-text-meta uk-margin-remove-top"><time>{{date createdAt "YYYY-MM-DD"}}</time></p>
</div>
</div>
</div>

<div class="uk-card-body" uk-height-viewport="expand: true">
<p>{{excerpt}}</p>
</div>

<div class="uk-card-footer">
<a href="{{url}}" class="uk-button uk-button-text">Read more</a>
</div>
</div>
</div>
{{/checkIf}}
{{/unless}}
{{/each}}
</div>
</div>
</div>
{{! /Posts }}
{{> readings }}

{{> footer}}
8 changes: 5 additions & 3 deletions luci.lang.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"partials": {

"pagination": {
"prev": "Previous",
"next": "Next"
Expand All @@ -14,8 +14,10 @@
},

"post": {
"publishedBy": "By ",
"lastUpdatedDate": "Updated on: ",
"publishedBy": "Written by ",
"publishedDate": "on ",
"mainTag": "Posted in ",
"lastUpdatedDate": "Last updated on ",
"previousPost": "Previous",
"nextPost": "Next",
"relatedPosts": "Author: "
Expand Down
2 changes: 1 addition & 1 deletion partials/navbar.hbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<nav class="uk-navbar-container" uk-navbar>
<nav class="uk-navbar-container" uk-navbar uk-sticky>
<div class="uk-navbar-left uk-navbar-center">
<a class="uk-navbar-item uk-logo" href="{{@website.url}}" aria-label="Back to Home">
{{#if @website.logo}}
Expand Down
52 changes: 52 additions & 0 deletions partials/readings.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{{! Posts listing }}
<div class="uk-section">
<a id="readings"></a>

<div class="uk-container uk-dark" uk-scrollspy="cls: uk-animation-slide-right">
<h2 class="uk-heading-divider">Readings</h2>

<div class="uk-grid-small uk-child-width-1-2@m" uk-grid uk-height-match=".uk-card-body > p">
{{#each @website.contentStructure.posts}}
{{#unless isHidden}}
{{#checkIf template '!=' "portfolio"}}
<a href="{{url}}" class="uk-link-reset">
<div uk-scrollspy="cls: uk-animation-fade">
<div class="uk-card uk-card-secondary">
<div class="uk-cover-container uk-card-media-top">
{{#checkIfAll featuredImage featuredImage.urlMd}}
<img src="{{featuredImage.urlMd}}" alt="" uk-cover>
{{else}}
<img src="{{@config.custom.postDefaultHeaderImageUrl}}" uk-cover>
{{/checkIfAll}}
<canvas width="300" height="300"></canvas>
</div>

<div class="uk-card-header">
<div class="uk-grid-small uk-flex-middle" uk-grid>
<div class="uk-width-auto">
<img class="uk-border-circle" width="40" height="40" src="{{author.avatarImage.url}}" alt="Avatar">
</div>
<div class="uk-width-expand">
<h3 class="uk-card-title uk-margin-remove-bottom">{{title}}</h3>
<p class="uk-text-meta uk-margin-remove-top"><time>{{date createdAt "YYYY-MM-DD"}}</time></p>
</div>
</div>
</div>

<div class="uk-card-body" uk-height-viewport="expand: true">
<p>{{excerpt}}</p>
</div>

<div class="uk-card-footer">
<p>{{mainTag.name}}</p>
</div>
</div>
</div>
</a>
{{/checkIf}}
{{/unless}}
{{/each}}
</div>
</div>
</div>
{{! /Posts }}
42 changes: 5 additions & 37 deletions partials/sidebar.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
<ul>

{{! loop }}
{{#getPostsByTags (concatenate "count=" @config.custom.amountSelectedtPosts "&tag_as=id&tags=" @config.custom.selectedPosts
"&excluded=0&offset=0&orderby=modifiedAt&ordering=asc")}}
{{#getPostsByTags (concatenate "count=" @config.custom.amountSelectedtPosts "&tag_as=id&tags=" post.mainTag.id "&excluded=0&offset=0&orderby=modifiedAt&ordering=asc")}}
<li>
<a href="{{url}}">{{title}}</a>
<a href="{{url}}">{{title}}</a>
</li>
{{/getPostsByTags}}
{{! /loop }}
Expand All @@ -21,8 +20,8 @@
{{#if featuredPosts}}
<section>
<h3>{{ translate 'partials.sidebar.featuredPosts' }}</h3>
<ol class="featured-posts__list">

<ul class="featured-posts__list">

{{! loop generating a list of featured posts}}
{{#each featuredPosts}}
Expand All @@ -32,39 +31,8 @@
{{/each}}
{{! /loop generating a list of featured posts}}

</ol>
</ul>
</section>
{{/if}}
{{! /check if featured posts exists}}
{{! /the list of featured posts }}

{{! the list of authors }}
{{! check if the authors section is enabled}}
{{#if @config.custom.authors}}
<section>
<h3>{{ translate 'partials.sidebar.authors' }}</h3>
<ul>

{{! loop generating a list of authors }}
{{#each authors}}
{{#checkIf @index '<' @config.custom.authorsNumber}} {{! the number of authors is specified in the theme option (located in Theme -> Sidebar)}}
<li>
<a href="{{url}}" >
<img
src="{{avatarImage.url}}"
{{lazyload "lazy"}}
alt="{{avatarImage.alt}}"
height="{{avatarImage.height}}"
width="{{avatarImage.width}}">
</a>
<a href="{{url}}">{{name}} <sup>{{postsNumber}}</sup></a>
</li>
{{/checkIf}}
{{/each}}
{{! /loop generating a list of authors }}

</ul>
</section>
{{/if}}
{{! /check if the authors section is enabled}}
{{! /the list of authors }}
Loading

0 comments on commit 964391b

Please sign in to comment.