mirror of
https://git.adityakumar.xyz/hugo-theme-introduction.git
synced 2024-12-23 15:12:53 +00:00
81 lines
3.4 KiB
HTML
81 lines
3.4 KiB
HTML
{{ with .Site.GetPage "section" "projects" }}
|
|
<div class="section" id="{{ .Title | urlize }}">
|
|
<!-- Begin Projects container -->
|
|
<div class="container">
|
|
<h2 class="title is-2 has-text-centered">
|
|
{{ .Title }}
|
|
</h2>
|
|
<div class="section is-small">
|
|
<div class="columns is-multiline">
|
|
{{ $totalProjects := (len .Pages) }}
|
|
{{ $numberOfProjectsToShow := .Site.Params.numberOfProjectsToShow | default $totalProjects }}
|
|
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
|
|
{{ if eq (mod $numberOfProjectsToShow 2) 0 }}
|
|
<div class="column is-half">
|
|
{{ else }}
|
|
<div class="column is-one-third">
|
|
{{ end }}
|
|
<div class="card" data-target="#project-{{ $index }}">
|
|
<div class="card-image">
|
|
<figure class="image is-3by2">
|
|
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
|
|
{{ with .Resources.ByType "image" }}
|
|
{{ range first 1 (sort . "Params.weight") }}
|
|
{{ $image := .Resize "302x" }}
|
|
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
|
|
{{ end }}
|
|
{{ end }}
|
|
</a>
|
|
</figure>
|
|
</div>
|
|
<div class="card-content has-text-centered top-pad">
|
|
<a {{ if .Params.external_link }} href="{{ .Params.external_link }}" {{ end }}>
|
|
{{ .Title }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</div>
|
|
{{ if lt $numberOfProjectsToShow $totalProjects }}
|
|
<div class="container has-text-centered top-pad">
|
|
<a href="{{ .RelPermalink }}">{{ i18n "index_projects_allProjects" . }}</a>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
<!-- End Projects container -->
|
|
<!-- Projects modals -->
|
|
{{ range $index, $element := .Pages.ByWeight | first $numberOfProjectsToShow }}
|
|
{{ if not .Params.external_link }}
|
|
<div class="modal" id="project-{{ $index }}">
|
|
<div class="modal-background"></div>
|
|
<div class="modal-card">
|
|
{{ with .Title }}
|
|
<header class="modal-card-header bottom-pad">
|
|
<p class="modal-card-title has-text-centered">{{ . }}</p>
|
|
</header>
|
|
{{ end }}
|
|
|
|
{{ with .Resources.ByType "image" }}
|
|
{{ range first 1 (sort . "Params.weight") }}
|
|
{{ $image := .Resize "640x" }}
|
|
<img src="{{ $image.Permalink }}" alt ="{{ $image.Name }}">
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ with .Content }}
|
|
<section class="modal-card-body markdown">
|
|
{{ . }}
|
|
</section>
|
|
{{ end }}
|
|
</div>
|
|
<button class="modal-close is-large" aria-label="close" data-target="#project-{{ $index }}"></button>
|
|
</div>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ partial "top-icon.html" . }}
|
|
</div>
|
|
<!-- End Projects section -->
|
|
<div class="container"><hr></div>
|
|
{{ end }}
|