Lego2012
6/28/2017 - 4:20 PM

List of Posts with certain Tags

List of Posts with certain Tags

{{ $.Scratch.Add "mlposts" slice }}
{{ $tags := (slice "Machine Learning" "EDA" "Kaggle" "ML" "Deep Learning" "DL" "Data Science") }}
{{ range .Site.RegularPages }}
    {{ $page := . }}
    {{ $has_common_tags := intersect $tags .Params.tags | len | lt 0 }}
    {{ if $has_common_tags }}
        {{ $.Scratch.Add "mlposts" $page }}
    {{ end }}
{{ end }}
{{ $cand := .Scratch.Get "mlposts" }}
{{ range first 10 $cand }}
    {{ .Render "li"}}
{{ end }}