Commit 035194df authored by Francisco Jesús Acién Pérez's avatar Francisco Jesús Acién Pérez
Browse files

simplifying code

parent 88a58d08
{{ define "main" }}
<div class="main" role="main">
<article class="article">
<div class="container">
{{ with .Params.image }}<img src="{{ . }}" class="article-image" />{{ end }}
{{ with .Params.series }}<p class="article-title-series"><a href="{{ "/" | relURL }}series/{{ index . 0 | urlize }}/">{{ index . 0 }}</a>&nbsp;/</p>{{ end }}
<h1 class="article-title">{{ .Title }}</h1>
{{ with .Params.subtitle }}<h2 class="article-subtitle">{{ . }}</h2>{{ end }}
<hr class="article-title-bottom">
<ul class="article-meta">
<li class="article-meta-date"><time>{{ .Date.Format (default "January 2, 2006" $.Site.Params.dateFormat) }}</time></li>
<li class="article-description">{{ .Params.description }}</li>
{{- if .Params.categories }}
{{- range .Params.categories }}
<li class="article-meta-categories">
......@@ -31,51 +31,139 @@
{{- end }}
</ul>
{{ partial "toc.html" . }}
{{ .Content }}
</article>
{{- if .Params.series }}
<section class="article-series">
{{- $thispagefilepath := .File.Path }}
{{- range .Params.series }}
{{- $lseries := replaceRE "( |–)" "-" (lower .) }}
<h2 class="series-title"><a href="{{ "/" | relURL }}series/{{ . | urlize }}/"><i class="fas fa-book"></i>&nbsp;{{ . }}</a></h2>
<ol reversed="reversed" class="series">
{{- range (index $.Site.Taxonomies.series $lseries).Pages.ByDate.Reverse }}
{{- if eq $thispagefilepath .File.Path }}
<li class="active">{{ .LinkTitle }}</li>
{{- else }}
<li><a href="{{ .Permalink | relURL }}">{{ .LinkTitle }}</a></li>
{{- end }}
{{- end }}
</ol>
{{- end }}
</section>
{{- end }}
{{ partial "share.html" . }}
{{- if and .Site.DisqusShortname (or (not (isset .Params "comments")) (eq .Params.comments nil) .Params.comments) }}
<div class="disqus-comments">
{{ template "_internal/disqus.html" . }}
</div>
{{- end }}
<ul class="pager article-pager">
{{- if .NextInSection }}
<li class="pager-newer">
<a href="{{ .NextInSection.Permalink | relURL }}" data-toggle="tooltip" data-placement="top" title="{{ .NextInSection.Title }}">&lt; Newer</a>
</li>
{{- else }}
<li class="pager-newer pager-noitem">&lt; Newer</li>
{{- end }}
{{- if .PrevInSection }}
<li class="pager-older">
<a href="{{ .PrevInSection.Permalink | relURL }}" data-toggle="tooltip" data-placement="top" title="{{ .PrevInSection.Title }}">Older &gt;</a>
</li>
{{- else }}
<li class="pager-older pager-noitem">Older &gt;</li>
{{- end }}
</ul>
<div class="article-content">
{{- if .Params.logo }}
<div class="row card-row">
<div class="col card-col">
<div class="card card-project">
{{ with .Params.logo }}<img class="card-img-top" src="{{ . }}" alt="Card image cap"> {{ end }}
<div class="card-body text-center">
{{- if .Params.github }}
{{ with .Params.github }}<a href="{{ . }}"><i class="fab fa-github fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.gitlab }}
{{ with .Params.gitlab }}<a href="{{ . }}"><i class="fab fa-gitlab fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.docs }}
{{ with .Params.docs }}<a href="{{ . }}"><i class="fas fa-book fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.docker }}
{{ with .Params.docker }}<a href="{{ . }}"><i class="fab fa-docker fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.pypi }}
{{ with .Params.pypi }}<a href="{{ . }}"><i class="fab fa-python fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
</div>
</div>
{{- if .Params.demos }}
{{- if gt (len .Params.demos) 1 }}
<div class="card text-center card-project">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
{{ range $index, $vale := .Params.demos }}
{{ range where $.Site.Pages "File.BaseFileName" . }}
<li class="nav-item">
<a class="nav-link {{- if eq $index 0 }} show active {{ end }}" id="{{ .Params.id }}-tab" data-toggle="tab" href="#{{ .Params.id }}" role="tab" aria-controls="{{ .Params.id }}" aria-selected="true"> Demo {{ add $index 1 }}</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>
<div class="tab-content" id="myTabContent">
{{ range $index, $vale := .Params.demos }}
{{ range where $.Site.Pages "File.BaseFileName" . }}
<div class="card-body tab-pane fade {{- if eq $index 0 }} show active {{ end }}" id="{{ .Params.id }}" role="tabpanel" aria-labelledby="{{ .Params.id }}-tab">
<h5 class="card-title"> {{ .Title }}</h5>
<p class="card-text"> {{ .Params.subtitle }}</p>
<a href="{{ .Params.demo }}" class="btn btn-primary">Show more</a>
</div>
{{ end }}
{{ end }}
</div>
</div>
{{- else if eq (len .Params.demos) 1 }}
{{ range where $.Site.Pages "File.BaseFileName" ( index .Params.demos 0 ) }}
<div class="card card-project">
<div class="card-body text-center">
<h5 class="card-title"> {{ .Title }}</h5>
<p class="card-text"> {{ .Params.subtitle }}</p>
<a href=" {{ .Params.demo }}" class="btn btn-primary">Show more</a>
</div>
</div>
{{ end }}
{{ end }}
{{ end }}
</div>
</div>
{{ end }}
{{ .Content }}
</div>
<div class="related">
{{ $relatedPages := slice }}
{{ if .Params.related }}
<h3>Related projects</h3>
<div class="row">
{{ range .Params.related }}
{{ range where $.Site.Pages "File.BaseFileName" . }}
{{ $relatedPages = $relatedPages | append . }}
<div class="col-auto mb-3" style="width: 18rem;">
<div class="card">
{{ if .Params.logo }}
<a href="{{ .RelPermalink }}">{{ with .Params.logo }}<img class="card-img-top" src="{{ . }}" alt="Card image cap">{{ end }}</a>
{{ end }}
<div class="card-body">
<a href="{{ .RelPermalink }}"><h5 class="card-title">{{ .Title }}</h5></a>
{{ if .Params.subtitle }}
{{ with .Params.subtitle }}<p class="card-text">{{ . }}</p> {{ end }}
{{ end }}
</div>
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
<!-- Proyectos similares (con la misma categoria o las mismas tags) -->
{{ $related := (where .Site.RegularPages "Section" "projects").RelatedIndices . "categories" "tags" | first 5 }}
{{ $related := $related | complement $relatedPages }} <!-- Delete posts that are on .Params.related -->
{{ with $related }}
<h3>See also</h3>
<div class="row">
{{ range . }}
<div class="col-auto mb-3" style="width: 18rem;">
<div class="card">
{{ if .Params.logo }}
<a href="{{ .RelPermalink }}">{{ with .Params.logo }}<img class="card-img-top" src="{{ . }}" alt="Card image cap">{{ end }}</a>
{{ end }}
<div class="card-body">
<a href="{{ .RelPermalink }}"><h5 class="card-title">{{ .Title }}</h5></a>
{{ if .Params.subtitle }}
{{ with .Params.subtitle }}<p class="card-text">{{ . }}</p> {{ end }}
{{ end }}
</div>
</div>
</div>
{{ end }}
</div>
{{ end }}
</div>
</div>
</article>
</div>
{{ end }}
{{ define "main" }}
<div class="main" role="main">
<article class="article">
<div class="container">
{{ with .Params.image }}<img src="{{ . }}" class="article-image" />{{ end }}
{{ with .Params.series }}<p class="article-title-series"><a href="{{ "/" | relURL }}series/{{ index . 0 | urlize }}/">{{ index . 0 }}</a>&nbsp;/</p>{{ end }}
<h1 class="article-title">{{ .Title }}</h1>
<hr class="article-title-bottom">
<ul class="article-meta">
<li class="article-description">{{ .Params.description }}</li>
{{- if .Params.categories }}
{{- range .Params.categories }}
<li class="article-meta-categories">
<a href="{{ "/" | relURL }}categories/{{ . | urlize }}/">
<i class="fas fa-folder"></i>
{{ . }}
</a>&nbsp;
</li>
{{- end }}
{{- end }}
{{- if .Params.tags }}
{{- range .Params.tags }}
<li class="article-meta-tags">
<a href="{{ "/" | relURL }}tags/{{ . | urlize }}/">
<i class="fas fa-tag"></i>
{{ . }}
</a>&nbsp;
</li>
{{- end }}
{{- end }}
</ul>
{{ partial "toc.html" . }}
<div class="article-content">
{{- if .Params.logo }}
<div class="row card-row">
<div class="col card-col">
<div class="card card-project">
{{ with .Params.logo }}<img class="card-img-top" src="{{ . }}" alt="Card image cap"> {{ end }}
<div class="card-body text-center">
{{- if .Params.github }}
{{ with .Params.github }}<a href="{{ . }}"><i class="fab fa-github fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.gitlab }}
{{ with .Params.gitlab }}<a href="{{ . }}"><i class="fab fa-gitlab fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.docs }}
{{ with .Params.docs }}<a href="{{ . }}"><i class="fas fa-book fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.docker }}
{{ with .Params.docker }}<a href="{{ . }}"><i class="fab fa-docker fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
{{- if .Params.pypi }}
{{ with .Params.pypi }}<a href="{{ . }}"><i class="fab fa-python fa-lg icon" style="color:#00a9e0"></i></a>{{ end }}
{{ end }}
</div>
</div>
{{- if .Params.demos }}
{{- if gt (len .Params.demos) 1 }}
<div class="card text-center card-project">
<div class="card-header">
<ul class="nav nav-tabs card-header-tabs">
{{ range $index, $vale := .Params.demos }}
{{ range where $.Site.Pages "File.BaseFileName" . }}
<li class="nav-item">
<a class="nav-link {{- if eq $index 0 }} show active {{ end }}" id="{{ .Params.id }}-tab" data-toggle="tab" href="#{{ .Params.id }}" role="tab" aria-controls="{{ .Params.id }}" aria-selected="true"> Demo {{ add $index 1 }}</a>
</li>
{{ end }}
{{ end }}
</ul>
</div>
<div class="tab-content" id="myTabContent">
{{ range $index, $vale := .Params.demos }}
{{ range where $.Site.Pages "File.BaseFileName" . }}
<div class="card-body tab-pane fade {{- if eq $index 0 }} show active {{ end }}" id="{{ .Params.id }}" role="tabpanel" aria-labelledby="{{ .Params.id }}-tab">
<h5 class="card-title"> {{ .Title }}</h5>
<p class="card-text"> {{ .Params.subtitle }}</p>
<a href="{{ .Params.demo }}" class="btn btn-primary">Show more</a>
</div>
{{ end }}
{{ end }}
</div>
</div>
{{- else if eq (len .Params.demos) 1 }}
{{ range where $.Site.Pages "File.BaseFileName" ( index .Params.demos 0 ) }}
<div class="card card-project">
<div class="card-body text-center">
<h5 class="card-title"> {{ .Title }}</h5>
<p class="card-text"> {{ .Params.subtitle }}</p>
<a href=" {{ .Params.demo }}" class="btn btn-primary">Show more</a>
</div>
</div>
{{ end }}
{{ end }}
{{ end }}
</div>
</div>
{{ end }}
{{ .Content }}
</div>
<div class="related">
{{ $relatedPages := slice }}
{{ if .Params.related }}
<h3>Related projects</h3>
<div class="row">
{{ range .Params.related }}
{{ range where $.Site.Pages "File.BaseFileName" . }}
{{ $relatedPages = $relatedPages | append . }}
<div class="col-auto mb-3" style="width: 18rem;">
<div class="card">
{{ if .Params.logo }}
<a href="{{ .RelPermalink }}">{{ with .Params.logo }}<img class="card-img-top" src="{{ . }}" alt="Card image cap">{{ end }}</a>
{{ end }}
<div class="card-body">
<a href="{{ .RelPermalink }}"><h5 class="card-title">{{ .Title }}</h5></a>
{{ if .Params.subtitle }}
{{ with .Params.subtitle }}<p class="card-text">{{ . }}</p> {{ end }}
{{ end }}
</div>
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}
<!-- Proyectos similares (con la misma categoria o las mismas tags) -->
{{ $related := (where .Site.RegularPages "Section" "projects").RelatedIndices . "categories" "tags" | first 5 }}
{{ $related := $related | complement $relatedPages }} <!-- Delete posts that are on .Params.related -->
{{ with $related }}
<h3>See also</h3>
<div class="row">
{{ range . }}
<div class="col-auto mb-3" style="width: 18rem;">
<div class="card">
{{ if .Params.logo }}
<a href="{{ .RelPermalink }}">{{ with .Params.logo }}<img class="card-img-top" src="{{ . }}" alt="Card image cap">{{ end }}</a>
{{ end }}
<div class="card-body">
<a href="{{ .RelPermalink }}"><h5 class="card-title">{{ .Title }}</h5></a>
{{ if .Params.subtitle }}
{{ with .Params.subtitle }}<p class="card-text">{{ . }}</p> {{ end }}
{{ end }}
</div>
</div>
</div>
{{ end }}
</div>
{{ end }}
</div>
</div>
</article>
</div>
{{ end }}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment