Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/forestryio/hugo-theme-novela.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTanner Smith <tannersmithtn95@gmail.com>2019-10-02 20:58:09 +0300
committerGitHub <noreply@github.com>2019-10-02 20:58:09 +0300
commit4d0f2a1fbecb7cf2aab6befe4d07629728934a21 (patch)
tree539d4e2d18f8b2abb89fa3533f2e9f63dd1d4bed
parent805f71623bee0b07f9764f2eed03b1c8fec0d813 (diff)
parented82213fe11961b66e72b49263eaebbe9f4a1ab6 (diff)
Merge pull request #19 from theNewDynamic/improve-hugo-logic
Improve hugo logic
-rw-r--r--.gitignore1
-rw-r--r--content/posts/2017-04-27-building-hoppers-media-centre.md2
-rw-r--r--content/posts/2017-04-28-understanding-the-gatsby-lifecycle.md2
-rw-r--r--content/posts/2017-04-30-how-figma-changed-how-we-design.md2
-rw-r--r--content/posts/2017-04-30-why-we-built-a-company-before-a-product.md2
-rw-r--r--content/posts/2017-04-31-how-figma-changed-how-we-design.md2
-rw-r--r--content/posts/2018-04-26-how-figma-changed-how-we-design.md2
-rw-r--r--content/posts/2018-04-27-building-hoppers-media-centre-secret.md2
-rw-r--r--content/posts/2018-04-27-how-figma-changed-how-we-design.md2
-rw-r--r--content/posts/2018-04-28-building-hoppers-media-centre.md2
-rw-r--r--content/posts/2018-04-29-understanding-the-gatsby-lifecycle.md2
-rw-r--r--content/posts/2018-04-30-why-we-built-a-company-before-a-product.md2
-rw-r--r--content/posts/2018-04-31-building-the-new-hopper-com.md2
-rw-r--r--content/posts/2019-04-26-building-hoppers-media-centre.md2
-rw-r--r--content/posts/2019-04-27-how-figma-changed-how-we-design.md2
-rw-r--r--content/posts/2019-04-28-how-figma-changed-how-we-design.md2
-rw-r--r--content/posts/2019-04-29-building-the-new-hopper-com.md2
-rw-r--r--content/posts/2019-04-30-why-we-built-a-company-before-a-product.md2
-rw-r--r--content/posts/2019-04-31-understanding-the-gatsby-lifecycle.md8
-rw-r--r--layouts/partials/article/article_authors.html117
-rw-r--r--layouts/partials/article/article_hero.html2
-rw-r--r--layouts/partials/article/article_next.html75
-rw-r--r--layouts/partials/articles/articles_list.html23
-rw-r--r--layouts/partials/author/author_articles_list.html71
-rw-r--r--layouts/partials/func/GetArticleAuthors.html39
-rw-r--r--layouts/partials/func/GetArticles.html5
-rw-r--r--layouts/partials/func/GetAuthorArticles.html4
27 files changed, 185 insertions, 194 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d70ebaa
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+public \ No newline at end of file
diff --git a/content/posts/2017-04-27-building-hoppers-media-centre.md b/content/posts/2017-04-27-building-hoppers-media-centre.md
index 2e5d07a..d3bb1c9 100644
--- a/content/posts/2017-04-27-building-hoppers-media-centre.md
+++ b/content/posts/2017-04-27-building-hoppers-media-centre.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-3.jpg
excerpt: Creating a new website for Hopper, one of the top 4 most downloaded travel apps in the U.S, along with Uber, Lyft.
timeToRead: 8
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2017-04-28-understanding-the-gatsby-lifecycle.md b/content/posts/2017-04-28-understanding-the-gatsby-lifecycle.md
index db4f97b..70b0ea7 100644
--- a/content/posts/2017-04-28-understanding-the-gatsby-lifecycle.md
+++ b/content/posts/2017-04-28-understanding-the-gatsby-lifecycle.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-2.jpg
excerpt: With the growing community interest in Gatsby, we hope to create more resources that make it easier for anyone to grasp the power of this incredible tool.
timeToRead: 4
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2017-04-30-how-figma-changed-how-we-design.md b/content/posts/2017-04-30-how-figma-changed-how-we-design.md
index 2192eb0..9220c49 100644
--- a/content/posts/2017-04-30-how-figma-changed-how-we-design.md
+++ b/content/posts/2017-04-30-how-figma-changed-how-we-design.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-5.jpg
excerpt: To understand why Figma is the best design tool for our company, you have to understand what we do. As a designer.
timeToRead: 8
authors:
- - "authors/thiago-costa"
+ - "authors/thiago-costa.md"
type: post
layout: post
---
diff --git a/content/posts/2017-04-30-why-we-built-a-company-before-a-product.md b/content/posts/2017-04-30-why-we-built-a-company-before-a-product.md
index 472061f..beec56e 100644
--- a/content/posts/2017-04-30-why-we-built-a-company-before-a-product.md
+++ b/content/posts/2017-04-30-why-we-built-a-company-before-a-product.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-6.jpg
excerpt: Creating a new website for Hopper, one of the top 4 most downloaded travel apps in the U.S, along with Uber, Lyft.
timeToRead: 3
authors:
- - "authors/thiago-costa"
+ - "authors/thiago-costa.md"
type: post
layout: post
---
diff --git a/content/posts/2017-04-31-how-figma-changed-how-we-design.md b/content/posts/2017-04-31-how-figma-changed-how-we-design.md
index 405cb80..8b6f208 100644
--- a/content/posts/2017-04-31-how-figma-changed-how-we-design.md
+++ b/content/posts/2017-04-31-how-figma-changed-how-we-design.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-4.jpg
excerpt: To understand why Figma is the best design tool for our company, you have to understand what we do. As a designer.
timeToRead: 8
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2018-04-26-how-figma-changed-how-we-design.md b/content/posts/2018-04-26-how-figma-changed-how-we-design.md
index 90de75c..d9dff46 100644
--- a/content/posts/2018-04-26-how-figma-changed-how-we-design.md
+++ b/content/posts/2018-04-26-how-figma-changed-how-we-design.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-4.jpg
excerpt: To understand why Figma is the best design tool for our company, you have to understand what we do. As a designer.
timeToRead: 8
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2018-04-27-building-hoppers-media-centre-secret.md b/content/posts/2018-04-27-building-hoppers-media-centre-secret.md
index 6594b07..f6ac9f1 100644
--- a/content/posts/2018-04-27-building-hoppers-media-centre-secret.md
+++ b/content/posts/2018-04-27-building-hoppers-media-centre-secret.md
@@ -6,7 +6,7 @@ excerpt: Creating a new website for Hopper, one of the top 4 most downloaded tra
secret: true
timeToRead: 8
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2018-04-27-how-figma-changed-how-we-design.md b/content/posts/2018-04-27-how-figma-changed-how-we-design.md
index f4c05c7..f90cb15 100644
--- a/content/posts/2018-04-27-how-figma-changed-how-we-design.md
+++ b/content/posts/2018-04-27-how-figma-changed-how-we-design.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-5.jpg
excerpt: To understand why Figma is the best design tool for our company, you have to understand what we do. As a designer.
timeToRead: 8
authors:
- - "authors/thiago-costa"
+ - "authors/thiago-costa.md"
type: post
layout: post
---
diff --git a/content/posts/2018-04-28-building-hoppers-media-centre.md b/content/posts/2018-04-28-building-hoppers-media-centre.md
index 75f61fa..cf3afbc 100644
--- a/content/posts/2018-04-28-building-hoppers-media-centre.md
+++ b/content/posts/2018-04-28-building-hoppers-media-centre.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-3.jpg
excerpt: Creating a new website for Hopper, one of the top 4 most downloaded travel apps in the U.S, along with Uber, Lyft.
timeToRead: 8
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2018-04-29-understanding-the-gatsby-lifecycle.md b/content/posts/2018-04-29-understanding-the-gatsby-lifecycle.md
index 6112237..5874b67 100644
--- a/content/posts/2018-04-29-understanding-the-gatsby-lifecycle.md
+++ b/content/posts/2018-04-29-understanding-the-gatsby-lifecycle.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-2.jpg
excerpt: With the growing community interest in Gatsby, we hope to create more resources that make it easier for anyone to grasp the power of this incredible tool.
timeToRead: 4
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2018-04-30-why-we-built-a-company-before-a-product.md b/content/posts/2018-04-30-why-we-built-a-company-before-a-product.md
index b15017a..a0fb100 100644
--- a/content/posts/2018-04-30-why-we-built-a-company-before-a-product.md
+++ b/content/posts/2018-04-30-why-we-built-a-company-before-a-product.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-6.jpg
excerpt: Creating a new website for Hopper, one of the top 4 most downloaded travel apps in the U.S, along with Uber, Lyft.
timeToRead: 3
authors:
- - "authors/thiago-costa"
+ - "authors/thiago-costa.md"
type: post
layout: post
---
diff --git a/content/posts/2018-04-31-building-the-new-hopper-com.md b/content/posts/2018-04-31-building-the-new-hopper-com.md
index fc2b410..da20e81 100644
--- a/content/posts/2018-04-31-building-the-new-hopper-com.md
+++ b/content/posts/2018-04-31-building-the-new-hopper-com.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-2.jpg
excerpt: Creating a new website for Hopper, one of the top 4 most downloaded travel apps in the U.S, along with Uber, Lyft.
timeToRead: 4
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2019-04-26-building-hoppers-media-centre.md b/content/posts/2019-04-26-building-hoppers-media-centre.md
index 95186c3..eb5d9ac 100644
--- a/content/posts/2019-04-26-building-hoppers-media-centre.md
+++ b/content/posts/2019-04-26-building-hoppers-media-centre.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-3.jpg
excerpt: Creating a new website for Hopper, one of the top 4 most downloaded travel apps in the U.S, along with Uber, Lyft.
timeToRead: 8
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2019-04-27-how-figma-changed-how-we-design.md b/content/posts/2019-04-27-how-figma-changed-how-we-design.md
index 3ce3780..d3f0082 100644
--- a/content/posts/2019-04-27-how-figma-changed-how-we-design.md
+++ b/content/posts/2019-04-27-how-figma-changed-how-we-design.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-4.jpg
excerpt: To understand why Figma is the best design tool for our company, you have to understand what we do. As a designer.
timeToRead: 8
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2019-04-28-how-figma-changed-how-we-design.md b/content/posts/2019-04-28-how-figma-changed-how-we-design.md
index 1da5e04..c1ebe0b 100644
--- a/content/posts/2019-04-28-how-figma-changed-how-we-design.md
+++ b/content/posts/2019-04-28-how-figma-changed-how-we-design.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-5.jpg
excerpt: To understand why Figma is the best design tool for our company, you have to understand what we do. As a designer.
timeToRead: 8
authors:
- - "authors/thiago-costa"
+ - "authors/thiago-costa.md"
type: post
layout: post
---
diff --git a/content/posts/2019-04-29-building-the-new-hopper-com.md b/content/posts/2019-04-29-building-the-new-hopper-com.md
index c30b0cf..a36b0c0 100644
--- a/content/posts/2019-04-29-building-the-new-hopper-com.md
+++ b/content/posts/2019-04-29-building-the-new-hopper-com.md
@@ -6,7 +6,7 @@ excerpt: Creating a new website for Hopper, one of the top 4 most downloaded tra
show_subscription: true
timeToRead: 4
authors:
- - "authors/dennis-brotzky"
+ - "authors/dennis-brotzky.md"
type: post
layout: post
---
diff --git a/content/posts/2019-04-30-why-we-built-a-company-before-a-product.md b/content/posts/2019-04-30-why-we-built-a-company-before-a-product.md
index 37f20eb..305aae8 100644
--- a/content/posts/2019-04-30-why-we-built-a-company-before-a-product.md
+++ b/content/posts/2019-04-30-why-we-built-a-company-before-a-product.md
@@ -5,7 +5,7 @@ hero: /images/heros/hero-6.jpg
excerpt: this is my excerpt
timeToRead: 3
authors:
- - "authors/thiago-costa"
+ - "authors/thiago-costa.md"
type: post
layout: post
---
diff --git a/content/posts/2019-04-31-understanding-the-gatsby-lifecycle.md b/content/posts/2019-04-31-understanding-the-gatsby-lifecycle.md
index 92c283d..5780dbf 100644
--- a/content/posts/2019-04-31-understanding-the-gatsby-lifecycle.md
+++ b/content/posts/2019-04-31-understanding-the-gatsby-lifecycle.md
@@ -5,10 +5,10 @@ hero: /images/heros/hero-2.jpg
excerpt: With the growing community interest in Gatsby, we hope to create more resources that make it easier for anyone to grasp the power of this incredible tool.
timeToRead: 6
authors:
- - "authors/thiago-costa"
- - "authors/dennis-brotzky"
- - "authors/brad-tiller"
- - "authors/mack-mansouri"
+ - "authors/thiago-costa.md"
+ - "authors/dennis-brotzky.md"
+ - "authors/brad-tiller.md"
+ - "authors/mack-mansouri.md"
type: post
layout: post
---
diff --git a/layouts/partials/article/article_authors.html b/layouts/partials/article/article_authors.html
index 915eda5..66c39b1 100644
--- a/layouts/partials/article/article_authors.html
+++ b/layouts/partials/article/article_authors.html
@@ -1,106 +1,59 @@
-{{ $scratch := newScratch }}
-{{ $scratch.Set "numAuthors" 0 }}
-
-{{ $authors := .Params.authors }}
-
-{{ $scratch.Set "numAuthors" (len $authors) }}
-{{ $scratch.Set "authors" $authors }}
-
-{{ if eq ($scratch.Get "numAuthors") 1 }}
-
- {{ range $author := where .Site.RegularPages "Type" "author" }}
- {{ $authorPath := index ($scratch.Get "authors") 0 }}
- {{ $firstAuthor := .Site.GetPage $authorPath }}
- {{ if eq $author.Params.name $firstAuthor.Params.name }}
- <a href="{{ $author.Permalink }}" class="article-author-link">
- {{ if $author.Params.avatar }}
+{{ $authors := partialCached "func/GetArticleAuthors" . .File.UniqueID }}
+{{ if eq (len $authors) 1 }}
+ {{ with $author := index $authors 0 }}
+ <a href="{{ .URL }}" class="article-author-link">
+ {{ with .avatar }}
<div class="article-author-avatar">
- <img src="{{ $author.Params.avatar }}" />
+ <img src="{{ . }}" />
</div>
{{ end }}
- <strong>{{ $author.Params.name }}</strong>
+ {{ with .name }}
+ <strong>{{ . }}</strong>
+ {{ end }}
<span class="hide-on-mobile">,&nbsp;</span>
- </a>
- {{ end }}
+ </a>
{{ end }}
-
-{{ else if gt ($scratch.Get "numAuthors") 1 }}
+{{ else }}
<div class="article-coauthors-container">
- {{ $avatarsWidth:= mul ($scratch.Get "numAuthors") 15 }}
+ {{ $avatarsWidth:= mul (len $authors) 15 }}
<span id="collapsedCoauthors" class="article-coauthors-collapsed">
- <div class="article-coauthors-list" style="width: {{ $avatarsWidth }}px;">
-
- {{ $scratch := newScratch }}
- {{ $scratch.Set "matches" false }}
- {{ $scratch.Set "authors" .Params.authors }}
- {{ range $index, $author := where .Site.RegularPages "Type" "author" }}
- {{ $scratch.Set "nameHold" $author.Params.name }}
- {{ range $authorPath := $scratch.Get "authors" }}
- {{ $authorCompare := $.Site.GetPage $authorPath }}
- {{ if eq $authorCompare.Params.name ($scratch.Get "nameHold") }}
- {{ $scratch.Set "matches" true }}
- {{ end }}
- {{ end }}
- {{ if eq ($scratch.Get "matches") true }}
- {{ if $author.Params.avatar }}
+ <div class="article-coauthors-list" style="width: {{ $avatarsWidth }}px;">
+ {{ range $index, $author := $authors }}
+ {{ with .avatar }}
<div class="article-coauthors-avatar" style="left: {{ mul $index 15 }}px;">
- <img src="{{ $author.Params.avatar }}" />
+ <img src="{{ . }}" />
</div>
{{ end }}
{{ end }}
- {{ end }}
- </div>
- <strong class="article-coauthors-name-container">
- {{ $scratch.Set "matches" false }}
- {{ $scratch.Set "authors" .Params.authors }}
- {{ range $index, $author := where .Site.RegularPages "Type" "author" }}
- {{ $scratch.Set "nameHold" $author.Params.name }}
- {{ range $authorPath := $scratch.Get "authors" }}
- {{ $authorCompare := $.Site.GetPage $authorPath }}
- {{ if eq $authorCompare.Params.name ($scratch.Get "nameHold") }}
- {{ $scratch.Set "matches" true }}
- {{ end }}
- {{ end }}
- {{ if eq ($scratch.Get "matches") true }}
- {{ $author.Params.name }}{{ if ne (add $index 1) (len ($scratch.Get "authors")) }},{{ end }}
+ </div>
+ <strong class="article-coauthors-name-container">
+ {{ range $index, $author := $authors }}
+ {{ .firstname }}{{ if ne (add $index 1) (len $authors) }},{{ end }}
{{ end }}
- {{ end }}
- </strong>
- <div class="article-coauthors-icon-container">
- {{ partial "icons/ui/toggle-open.html" . }}
- </div>
+ </strong>
+ <div class="article-coauthors-icon-container">
+ {{ partial "icons/ui/toggle-open.html" . }}
+ </div>
</span>
<ul id="uncollapsedCoauthors" class="article-coauthors-list-open hidden">
<div id="uncollapsedAction" class="article-icon-open-container">
{{ partial "icons/ui/toggle-closed.html" . }}
</div>
- {{ $scratch.Set "matches" false }}
- {{ $scratch.Set "authors" .Params.authors }}
- {{ range $index, $author := where .Site.RegularPages "Type" "author" }}
- {{ $scratch.Set "nameHold" $author.Params.name }}
- {{ range $authorPath := $scratch.Get "authors" }}
- {{ $authorCompare := $.Site.GetPage $authorPath }}
- {{ if eq $authorCompare.Params.name ($scratch.Get "nameHold") }}
- {{ $scratch.Set "matches" true }}
- {{ end }}
- {{ end }}
- {{ if eq ($scratch.Get "matches") true }}
- <li class="article-coauthors-list-item-open">
- <a href="{{ $author.Permalink }}" class="article-author-link">
- {{ if $author.Params.avatar }}
- <div class="article-coauthor-avatar-open">
- <img src="{{ $author.Params.avatar }}" />
- </div>
- {{ end }}
- <strong class="article-author-name-open">{{ $author.Params.name }}</strong>
- </a>
- </li>
- {{ end }}
+ {{ range $index, $author := $authors }}
+ <li class="article-coauthors-list-item-open">
+ <a href="{{ .URL }}" class="article-author-link">
+ {{ with $author.avatar }}
+ <div class="article-coauthor-avatar-open">
+ <img src="{{ . }}" />
+ </div>
+ {{ end }}
+ <strong class="article-author-name-open">{{ .name }}</strong>
+ </a>
+ </li>
{{ end }}
</ul>
-
</div>
{{ end }}
diff --git a/layouts/partials/article/article_hero.html b/layouts/partials/article/article_hero.html
index d393288..ae85203 100644
--- a/layouts/partials/article/article_hero.html
+++ b/layouts/partials/article/article_hero.html
@@ -6,7 +6,7 @@
<div class="article-meta">
{{ partial "article/article_authors.html" . }}
{{ .Page.Date.Format "January 2, 2006" }}
- {{ if .Page.Params.timetoread }} • {{ .Page.Params.timetoread }} min read{{ end }}
+ {{ with .Page.Params.timetoread }} • {{ . }} min read{{ end }}
</div>
</div>
</header>
diff --git a/layouts/partials/article/article_next.html b/layouts/partials/article/article_next.html
index f55ef0b..f12f340 100644
--- a/layouts/partials/article/article_next.html
+++ b/layouts/partials/article/article_next.html
@@ -1,40 +1,57 @@
+{{/*
+ Prints the next 2 articles in the same section or, if less or 2 found, the first (and potentially second) of the section.
+
+ @author @regisphilibert @mountainbug95
+
+ @context Type Page (.)
+
+ @access public
+
+*/}}
+
+{{/* declaring next empty slice */}}
+{{ $next := slice }}
+{{/* Checking if current article has a PrevInSection (Prev as we are ordering dsc here.) */}}
+{{ with .PrevInSection }}
+ {{ $next = $next | append . }}
+ {{/* Checking for that "next" article own "next" to fill the "second next" */}}
+ {{ with .PrevInSection }}
+ {{ $next = $next | append . }}
+ {{ end }}
+{{ end }}
+{{/* If the number of found "next article" is less than two we need to find the first and potentially second article
+of the whole section and append them to our $next slice. */}}
+{{ $diff := sub 2 (len $next) }}
+{{ if $diff }}
+ {{/* We use that diff number (if > 0) to grab the first x number of articles */}}
+ {{ $articles := partialCached "func/GetArticles" . "articles"}}
+ {{ $next = $next | append (first $diff $articles) }}
+{{ end }}
<section class="section nartrow">
<h3 class="footer-next-heading">More articles from {{ .Site.Title }}</h3>
<div class="footer-spacer"></div>
<div class="next-articles-grid" numberOfArticles={numberOfArticles}>
<div class="post-row">
- {{ $scratch := newScratch }}
- {{ $scratch.Set "counter" 0 }}
- {{ $pageTitle := .Params.title }}
- {{ $scratch.Set "pt" $pageTitle }}
- {{ range $index, $article := where .Site.RegularPages "Type" "post" }}
- {{ if or (eq ($scratch.Get "counter") 1) (eq ($scratch.Get "counter") 2) }}
- <a href="{{ $article.Permalink }}" class="article-link"
- {{ if eq ($scratch.Get "counter") 1 }} id="article-link-bigger"{{ end }}>
+ {{ range $index, $article := $next }}
+ <a href="{{ $article.Permalink }}" class="article-link"
+ {{ if not $index}} id="article-link-bigger"{{ end }}>
+ <div>
+ <div class="image-container">
+ <img src="{{ $article.Params.hero }}" class="article-image" />
+ </div>
<div>
- <div class="image-container">
- <img src="{{ $article.Params.hero }}" class="article-image" />
- </div>
- <div>
- <h2 class="article-title">
- {{ $article.Params.title }}
- </h2>
- <p class="article-excerpt">
- {{ $article.Params.excerpt }}
- </p>
- <div class="article-metadata">
- {{ $article.Date | dateFormat "January 1, 2019" }}{{ with $article.Params.timeToRead }} · {{ $article.Params.timeToRead }} min read{{ end }}
- </div>
+ <h2 class="article-title">
+ {{ $article.Params.title }}
+ </h2>
+ <p class="article-excerpt">
+ {{ $article.Params.excerpt }}
+ </p>
+ <div class="article-metadata">
+ {{ $article.Date | dateFormat "January 1, 2006" }}{{ with $article.Params.timeToRead }} · {{ $article.Params.timeToRead }} min read{{ end }}
</div>
</div>
- </a>
- {{ $scratch.Set "counter" (add ($scratch.Get "counter") 1) }}
- {{ end }}
- {{ if eq .Params.title ($scratch.Get "pt") }}
- {{ if .Params.title }}
- {{ $scratch.Set "counter" 1 }}
- {{ end }}
- {{ end }}
+ </div>
+ </a>
{{ end }}
</div>
</div>
diff --git a/layouts/partials/articles/articles_list.html b/layouts/partials/articles/articles_list.html
index 9d6d8b4..1109650 100644
--- a/layouts/partials/articles/articles_list.html
+++ b/layouts/partials/articles/articles_list.html
@@ -1,24 +1,23 @@
<section class="section nartrow">
<div id="articlesList" class="articles-list-container show-details">
{{ $paginator := .Paginate (where .Site.RegularPages "Type" "post") }}
- {{ $scratch :=newScratch }}
- {{ $scratch.Set "biggerFirst" true }}
- {{ $scratch.Set "biggerPlaced" false }}
+ {{ $biggerFirst := true }}
+ {{ $biggerPlaced := false }}
{{ range $index, $article := $paginator.Pages }}
{{ $counter := mod $index 2 }}
- {{ if eq $counter 0 }}
+ {{ if not $counter }}
<div class="post-row">
{{ end }}
<a href="{{ $article.Permalink }}" class="article-link"
- {{ if and (eq ($scratch.Get "biggerFirst") true) (eq ($scratch.Get "biggerPlaced") false) }}
+ {{ if and (eq ($biggerFirst) true) (eq ($biggerPlaced) false) }}
{{ if eq $counter 0 }}
id="article-link-bigger"
- {{ $scratch.Set "biggerPlaced" true }}
+ {{ $biggerPlaced = true }}
{{ end }}
- {{ else if and (eq ($scratch.Get "biggerFirst") false) (eq ($scratch.Get "biggerPlaced") false) }}
+ {{ else if and (not $biggerFirst) (not $biggerPlaced) }}
{{ if ne $counter 0 }}
id="article-link-bigger"
- {{ $scratch.Set "biggerPlaced" true }}
+ {{ $biggerPlaced = true }}
{{ end }}
{{ end }}>
<div class="article-data-outer">
@@ -42,11 +41,11 @@
{{ $len := (where .Pages "Type" "posts") }}
{{ if or (eq $counter 0) (eq (add $index 1) $len) }}
</div>
- {{ $scratch.Set "biggerPlaced" false }}
- {{ if eq ($scratch.Get "biggerFirst") true }}
- {{ $scratch.Set "biggerFirst" false }}
+ {{ $biggerPlaced = false }}
+ {{ if $biggerFirst }}
+ {{ $biggerFirst = false }}
{{ else }}
- {{ $scratch.Set "biggerFirst" true }}
+ {{ $biggerFirst = true }}
{{ end }}
{{ end }}
{{ end }}
diff --git a/layouts/partials/author/author_articles_list.html b/layouts/partials/author/author_articles_list.html
index c1c08bb..b3b74ca 100644
--- a/layouts/partials/author/author_articles_list.html
+++ b/layouts/partials/author/author_articles_list.html
@@ -1,57 +1,30 @@
<section class="section nartrow author-alc-section">
<div id="articlesList" class="articles-list-container show-details author-alc">
- {{ $scratch :=newScratch }}
- {{ $scratch.Set "authorName" .Page.Params.name }}
- {{ $scratch.Set "biggerFirst" true }}
- {{ $scratch.Set "biggerPlaced" false }}
+ {{ $articles := partial "func/GetAuthorArticles" . }}
<div class="post-row-alt">
- {{ range $index, $article := where .Site.RegularPages "Type" "post" }}
-
- {{ $scratch.Set "authorMatch" false }}
- {{ range $author := $article.Params.authors }}
- {{ $authorPage := $.Site.GetPage $author }}
-
- {{ if eq $authorPage.Params.name ($scratch.Get "authorName") }}
- {{ $scratch.Set "authorMatch" true }}
- {{ end }}
- {{ end }}
-
- {{ $counter := mod $index 2 }}
- {{ if eq ($scratch.Get "authorMatch") true }}
- <a href="{{ $article.Permalink }}" class="article-link">
- <div class="article-data-outer">
- <div class="image-container">
- <img src="{{ $article.Params.hero }}" class="article-image" />
- </div>
- <div class="article-data">
- <h2 class="article-title">
- {{ $article.Params.title }}
- </h2>
- <p class="article-excerpt">
- {{ $article.Params.excerpt }}
- </p>
- <div class="article-metadata">
- {{ $article.Date.Format "January 2, 2006" }}{{ if $article.Params.timetoread }} • {{ $article.Params.timetoread }} min read{{ end }}
- </div>
- </div>
- </div>
- </a>
- {{ $counter := mod (add $index 1) 2 }}
- {{ $len := (where .Pages "Type" "posts") }}
- {{ end }}
- {{ end }}
+ {{ range $index, $article := $articles }}
+ {{ $counter := mod $index 2 }}
+ <a href="{{ $article.Permalink }}" class="article-link">
+ <div class="article-data-outer">
+ <div class="image-container">
+ <img src="{{ $article.Params.hero }}" class="article-image" />
+ </div>
+ <div class="article-data">
+ <h2 class="article-title">
+ {{ $article.Params.title }}
+ </h2>
+ <p class="article-excerpt">
+ {{ $article.Params.excerpt }}
+ </p>
+ <div class="article-metadata">
+ {{ $article.Date.Format "January 2, 2006" }}{{ if $article.Params.timetoread }} • {{ $article.Params.timetoread }} min read{{ end }}
+ </div>
+ </div>
+ </div>
+ </a>
+ {{ end }}
</div>
</div>
-
- <nav aria-label="Page navigation">
- <ul class="pagination">
- <li class="page-item active"><a href="/" class="page-link">1</a></li>
- <li class="page-item"><a href="/page/2/" class="page-link">2</a></li>
- <li class="page-item"><a href="/page/3/" class="page-link">3</a></li>
- <li class="page-item"><a href="/page/2/" rel="next" class="page-link page-next">Next</a></li>
- </ul>
- </nav>
-
</section>
{{ $script := resources.Get "js/toggleBorder.js" }}
diff --git a/layouts/partials/func/GetArticleAuthors.html b/layouts/partials/func/GetArticleAuthors.html
new file mode 100644
index 0000000..c6041e4
--- /dev/null
+++ b/layouts/partials/func/GetArticleAuthors.html
@@ -0,0 +1,39 @@
+{{/*
+ GetArticle Authors
+ Retrieve the authors assigned to a given article
+
+ @author @regisphilibert
+
+ @context Page (.) The article in quest
+
+ @access public
+
+ @return Slice
+ - String (.name)
+ - String (.URL)
+ - String (.name)
+ - String (.firstname)
+
+ @example - Go Template
+ {{ $authors := partialCached "func/GetArticleAuthors" . .File.UniqueID }}
+*/}}
+{{ $authors := slice }}
+{{ with .Params.authors }}
+ {{ range . }}
+ {{ with site.GetPage . }}
+ {{ $firstname := "" }}
+ {{ $name := "" }}
+ {{ $avatar := false }}
+ {{ with .Params.name }}
+ {{ $name = . }}
+ {{ $firstname = index (split . " ") 0 }}
+ {{ end }}
+ {{ with .Params.avatar }}
+ {{ $avatar = . }}
+ {{ end }}
+ {{ $authors = $authors | append (dict "URL" .RelPermalink "name" $name "firstname" $firstname "avatar" $avatar) }}
+ {{ end }}
+ {{ end }}
+{{ end }}
+
+{{ return $authors }} \ No newline at end of file
diff --git a/layouts/partials/func/GetArticles.html b/layouts/partials/func/GetArticles.html
new file mode 100644
index 0000000..ac996bc
--- /dev/null
+++ b/layouts/partials/func/GetArticles.html
@@ -0,0 +1,5 @@
+{{ $articles := slice }}
+{{ with where site.RegularPages "Type" "post" }}
+ {{ $articles = . }}
+{{ end }}
+{{ return $articles }} \ No newline at end of file
diff --git a/layouts/partials/func/GetAuthorArticles.html b/layouts/partials/func/GetAuthorArticles.html
new file mode 100644
index 0000000..318dfe6
--- /dev/null
+++ b/layouts/partials/func/GetAuthorArticles.html
@@ -0,0 +1,4 @@
+{{ $articles := slice }}
+{{ $articles = where .Site.RegularPages "Type" "post" }}
+{{ $articles = where $articles "Params.authors" "intersect" (slice .File.Path) }}
+{{ return $articles }} \ No newline at end of file