- {{- .Title -}} -
-{{ .Description | markdownify -}}
+ {{ $currentPage := .Page }} + {{ $currentTags := .Params.tags }} + {{ $currentCategories := .Params.categories }} + + {{ $videoPages := (where .Site.Pages ".Params.video_id" "!=" nil) }} + + {{ $matchingVideos := slice }} + + {{ range $videoPages }} + {{ $page := . }} + {{ $matchScore := 0 }} + + {{ range $currentTags }} + {{ if in $page.Params.tags . }} + {{ $matchScore = add $matchScore 1 }} + {{ end }} + {{ end }} + + {{ range $currentCategories }} + {{ if in $page.Params.categories . }} + {{ $matchScore = add $matchScore 2 }} + {{ end }} + {{ end }} + + {{ if gt $matchScore 0 }} + {{ $matchingVideos = $matchingVideos | append (dict "page" $page "score" $matchScore) }} + {{ end }} + + {{ end }} + + {{ $sortedVideos := sort $matchingVideos "score" "desc" }} + + + {{ if gt (len $sortedVideos) 0 }} + + {{ end }}