Skip to content
Permalink
Browse files

Add related series info to single post template

  • Loading branch information
marcguyer committed Dec 22, 2019
1 parent 363f282 commit 2c6711524e552f0672ad3bec68206afb7d8ae6f9
@@ -94,7 +94,7 @@ disqusShortname = "marcguyer"
mainSections = ["posts"]
readingTime = true
socialShare = true
delayDisqus = true
# delayDisqus = true
showRelatedPosts = true
comments = true

@@ -119,6 +119,7 @@ disqusShortname = "marcguyer"

# Prefix of link to the git commit detail page. GitInfo must be enabled.
gitUrl = "https://github.com/marcguyer/marcguyer.github.io/commit/"
commit = "https://github.com/marcguyer/marcguyer.github.io/commit/"

# Toggling this option needs to rebuild SCSS, requires Hugo extended version
justifyContent = false # Set "text-align: justify" to `.content`.
@@ -1,12 +1,11 @@
---
title: "Index"
title: "Senior Full Stack Web Systems Architect"
date: 2019-12-21T09:42:49-04:00
draft: false
---

* PHP & Laminas (Zend Framework) Specialist
* REST API and Payment Systems Expert
* Open Source Contributor
* Private Pilot

Available for hire - [Ask me anything about your project](//scr.im/marcguyer)
@@ -1,5 +1,5 @@
---
title: "Example Application with Mezzio: Introduction"
title: "Mezzio Example: Introduction"
date: 2019-11-04T15:08:36-04:00
draft: false
toc: false
@@ -11,16 +11,16 @@ tags:
- prophecy
- phpunit
series:
- "Example Application with Mezzio"
- "Mezzio Example"
---

## What is this?

Let's create a REST API with [Laminas](https://getlaminas.org/) [Mezzio](https://getexpressive.org/). In this series, you'll learn how to create a REST API from the ground up. We'll use Mezzio as the base framework, Doctrine for the data layer, OAuth2 for authentication and authorization, and Phpunit for automated testing.
Let's create a REST API with [Laminas](https://getlaminas.org/) [Mezzio](https://getexpressive.org/). In this series, you'll learn how to create a REST API from the ground up. We'll use Mezzio as the base framework, Doctrine for the data layer, OAuth2 for authentication and authorization, PHPUnit for automated testing, and several other libraries along the way.

## Source Code

I've created a new bare-bones application using the [Mezzio Skeleton Application](https://github.com/zendframework/zend-expressive-skeleton) where all the code shown in this series lives. You can install it in your local environment and hack on it all you want. You're also welcome to contribute to the example application via PR. Check it out here:
I've created a new bare-bones application starting with the [Mezzio Skeleton Application](https://github.com/zendframework/zend-expressive-skeleton) where all the code shown in this series lives. You can install it in your local environment and hack on it all you want. You're also welcome to contribute to the example application via PR. Check it out here:

[Example Application with Mezzio, Doctrine, and OAuth2](https://github.com/marcguyer/mezzio-doctrine-oauth2-example)

@@ -1,5 +1,5 @@
---
title: "Example Application with Mezzio: Testing"
title: "Mezzio Example: Functional Testing"
date: 2019-12-01T14:28:49-05:00
draft: false
toc: false
@@ -11,7 +11,7 @@ tags:
- prophecy
- phpunit
series:
- "Example Application with Mezzio"
- "Mezzio Example"
---

## Where do we start?
@@ -0,0 +1,108 @@
{{ define "main" }}
<div class="container" role="main">
<div class="row">
<div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
<article role="main" class="blog-post">

{{ .Content }}

{{ if .Params.tags }}
<div class="blog-tags">
{{ range .Params.tags }}
<a href="{{ $.Site.LanguagePrefix | absURL }}/tags/{{ . | urlize }}/">{{ . }}</a>&nbsp;
{{ end }}
</div>
{{ end }}

{{ if $.Param "socialShare" }}
<hr/>
<section id="social-share">
<div class="list-inline footer-links">
{{ partial "share-links" . }}
</div>
</section>
{{ end }}

{{ if .Site.Params.showRelatedPosts }}

{{ $.Scratch.Set "seriesPages" slice }}
{{ if .Params.series }}
{{ $series := index .Params.series 0 }}
{{ $.Scratch.Set "seriesPages" (where .Site.Pages ".Params.series" "intersect" (first 1 .Params.series)) }}
<h4 class="see-also">Series: {{ $series }}</h4>
<ol>
{{ range sort (where .Site.Pages ".Params.series" "intersect" (first 1 .Params.series)) ".Date" }}
<li>
<a href="{{ .RelPermalink }}">{{ .Title }}</a>
</li>
{{ end }}
</ol>
{{ end }}

{{ $relatedPages := where (where .Site.Pages ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink }}
{{ $relatedPages := $relatedPages | complement ($.Scratch.Get "seriesPages") }}

{{ range first 1 $relatedPages }}
{{ $.Scratch.Set "has_related" true }}
{{ end }}

{{ if $.Scratch.Get "has_related" }}
<h4 class="see-also">{{ i18n "seeAlso" }}</h4>
<ul>
{{ $num_to_show := .Site.Params.related_content_limit | default 5 }}
{{ range first $num_to_show $relatedPages }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>

{{ end }}
{{ end }}
</article>

{{ if ne .Type "page" }}
<ul class="pager blog-pager">
{{ if .PrevInSection }}
<li class="previous">
<a href="{{ .PrevInSection.Permalink }}" data-toggle="tooltip" data-placement="top" title="{{ .PrevInSection.Title }}">&larr; {{ i18n "previousPost" }}</a>
</li>
{{ end }}
{{ if .NextInSection }}
<li class="next">
<a href="{{ .NextInSection.Permalink }}" data-toggle="tooltip" data-placement="top" title="{{ .NextInSection.Title }}">{{ i18n "nextPost" }} &rarr;</a>
</li>
{{ end }}
</ul>
{{ end }}


{{ if (.Params.comments) | or (and (or (not (isset .Params "comments")) (eq .Params.comments nil)) (and .Site.Params.comments (ne .Type "page"))) }}
{{ if .Site.DisqusShortname }}
{{ if .Site.Params.delayDisqus }}
<div class="disqus-comments">
<button id="show-comments" class="btn btn-default" type="button">{{ i18n "show" }} <span class="disqus-comment-count" data-disqus-url="{{ trim .Permalink "/" }}">{{ i18n "comments" }}</span></button>
<div id="disqus_thread"></div>

<script type="text/javascript">
var disqus_config = function () {
this.page.url = '{{ trim .Permalink "/" }}';
};

</script>
</div>
{{ else }}
<div class="disqus-comments">
{{ template "_internal/disqus.html" . }}
</div>
{{ end }}
{{ end }}
{{ if .Site.Params.staticman }}
<div class="staticman-comments">
{{ partial "staticman-comments.html" . }}
</div>
{{ end }}
{{ end }}

</div>
</div>
</div>
{{ end }}
@@ -8,7 +8,7 @@ build:
code: |
git submodule update --init --recursive
- arjen/hugo-build@2.9.1:
version: "0.60.1"
version: "0.61.0"
theme: beautifulhugo
flags: --buildDrafts=true
force_install: true

0 comments on commit 2c67115

Please sign in to comment.
You can’t perform that action at this time.