Commit 28fc3ac0 authored by Erik Faye-Lund 's avatar Erik Faye-Lund Committed by Erik Faye-Lund

frontpage: move content from layout to content

Currently, when you press the "Edit this page"-button on the front-page,
you get to a surprisingly empty page. This is because the whole
page-content was hard-coded into the layout-file. That's not ideal.

Part of the reason it was written this way, is due to all the custom
HTML in there, which isn't usually legal in Hugo markdown content files.

But instead, we can simply use a HTML content file as well as a custom
shortcode for the latest news section instead, and everything just as
intended. The custom partials we used for the apis and features
subsections can be repurposed as shortcodes as well.

This makes this stuff more in line with how these primitives are
intended to be used than what we used to do. And at the same time, we
get a much more meaningful "Edit this page"-behavior than before.
parent c048f0b3
Pipeline #154247 passed with stages
in 20 seconds
---
Menu: main
Title: Home
Weight: -10
---
<style>
[data-toggle="collapse"] > a > svg {
display: inline-block;
float: right;
width: 1em;
height: 1em;
transition: all 0.2s;
}
[data-toggle="collapse"].collapsed > a > svg {
transform: rotate(180deg);
}
@media (min-width: 1200px) {
.collapse.open-on-xl {
display: block !important;
height: auto !important;
visibility: visible;
}
}
</style>
<h2 class="collapsed d-xl-none" data-toggle="collapse" data-target="#apis-collapse" aria-expanded="false" aria-controls="apis-collapse">
<a role="button">
Featured APIs
{{< chevron-up >}}
</a>
</h2>
<p class="h2 d-none d-xl-block">Featured APIs</p>
{{< apis >}}
<hr>
<h2 class="collapsed" data-toggle="collapse" data-target="#drivers-collapse" aria-expanded="false" aria-controls="drivers-collapse">
<a role="button">
Supported Drivers
{{< chevron-up >}}
</a>
</h2>
{{< drivers >}}
<hr>
{{< latest-news >}}
---
Menu: main
Title: Home
Weight: -10
---
......@@ -2,65 +2,8 @@
{{ partial "jumbotron.html" . }}
<main class="container">
<style>
[data-toggle="collapse"] > a > svg {
display: inline-block;
float: right;
width: 1em;
height: 1em;
transition: all 0.2s;
}
[data-toggle="collapse"].collapsed > a > svg {
transform: rotate(180deg);
}
@media (min-width: 1200px) {
.collapse.open-on-xl {
display: block !important;
height: auto !important;
visibility: visible;
}
}
</style>
<h2 class="collapsed d-xl-none" data-toggle="collapse" data-target="#apis-collapse" aria-expanded="false" aria-controls="apis-collapse">
<a role="button">
Featured APIs
{{ partial "chevron-up.svg" . }}
</a>
</h2>
<p class="h2 d-none d-xl-block">Featured APIs</p>
{{ partial "apis.html" . }}
<hr>
<h2 class="collapsed" data-toggle="collapse" data-target="#drivers-collapse" aria-expanded="false" aria-controls="drivers-collapse">
<a role="button">
Supported Drivers
{{ partial "chevron-up.svg" . }}
</a>
</h2>
{{ partial "drivers.html" . }}
<hr>
<h2>Latest news</h2>
{{ $newsPages := where .Site.RegularPages "Type" "news" }}
{{ range first 3 $newsPages.ByPublishDate.Reverse }}
<h3>{{ .Title }}</h3>
{{ index (split .Content "</p>") 0 | safeHTML }}</p>
<a href="{{ .Permalink }}">Read full post</a>
<hr>
{{ end }}
<a href="{{ "/news/" | relURL }}">Read all news</a>
{{ .Content }}
</main>
{{ end }}
<h2>Latest news</h2>
{{ $newsPages := where .Site.RegularPages "Type" "news" }}
{{ range first 3 $newsPages.ByPublishDate.Reverse }}
<h3>{{ .Title }}</h3>
{{ index (split .Content "</p>") 0 | safeHTML }}</p>
<a href="{{ .Permalink }}">Read full post</a>
<hr>
{{ end }}
<a href="{{ "/news/" | relURL }}">Read all news</a>
Markdown is supported
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