New card template. Add settings to transpile sass with libsass or dartsass. Add setting to use internal pagination template. Wrap summary in p tags.

This commit is contained in:
Fredrik Jonsson 2023-01-25 10:03:12 +01:00
commit f58575e232
7 changed files with 19 additions and 8 deletions

View file

@ -220,6 +220,7 @@ params:
icon: "" # Relative path to icon in json feed and JSON-LD, no leading slash.
image: "" # Relative path to site image in JSON-LD, no leading slash.
imageMaxWidth: "" # Max width for images added via figure shortcode.
internalPagination: true # Use Hugos internal pagination template, default false.
jquery: true # Add jQuery, default false.
languageDir: "" # Set ltr or rtl, defaults to ltr.
logo: false # Turn off the logo.
@ -239,6 +240,7 @@ params:
privacyPolicyUrl: "" # If set will add link to cookie consent form.
realfavicongenerator: # If full set of favicons, site manifest etc. exists, default false.
relatedposts: true # Show related posts under a "See also" section, default false.
sassTranspiler: "dartsass"# The Sass transpiler to use, default "libsass".
searchLimit: 20 # Max number of search hits, default 20.
sidebar: true # Show a sidebar to the right, default false.
submitted: true # Show author and date information for a post.

View file

@ -0,0 +1,8 @@
<article class="card{{ with .Section }} card--{{ . | urlize }}{{ end }}">
<header>
<h2 class="title"><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
</header>
<div class="content">
<p>{{ .Summary }}</p>
</div>
</article>

View file

@ -4,6 +4,6 @@
{{ if $.Param "submitted" | default false }}{{ partial "submitted.html" . -}}{{ end }}
</header>
<div class="content">
{{ .Summary }}
<p>{{ .Summary }}</p>
</div>
</article>

View file

@ -2,11 +2,9 @@
{{ define "main" -}}
<main class="main layout__main">
<article class="single-view{{ with .Section }} single-view--{{ . | urlize }}{{ end }}">
<div class="content">
{{ .Content }}
</div>
</article>
{{ $pages := where site.RegularPages "Type" "in" site.Params.mainSections }}
{{ $paginator := .Paginate $pages -}}

View file

@ -1,4 +1,4 @@
<nav class="main-menu layout__navigation" aria-label="{{ i18n "menu_title" }}">
<nav class="main-menu{{ if not ($.Param "menuinheader") }} layout__navigation{{ end }}" aria-label="{{ i18n "menu_title" }}">
<ul class="navbar">
{{ if site.Menus.main -}}

View file

@ -1,11 +1,14 @@
{{ if $.Param "internalpagination" -}}
{{ template "_internal/pagination.html" . }}
{{ else -}}
{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) -}}
<nav class="pager">
{{ if .Paginator.HasPrev -}}
<a href="{{ .Paginator.Prev.URL }}" rel="prev" class="pager-item pager-prev">{{ i18n "pager_prev" }}</a>
<a href="{{ .Paginator.Prev.URL }}" rel="prev" class="pager__item pager__item--prev"><span aria-hidden="true">« </span>{{ i18n "pager_prev" }}</a>
{{ end -}}
{{ if .Paginator.HasNext -}}
<a href="{{ .Paginator.Next.URL }}" rel="next" class="pager-item pager-next">{{ i18n "pager_next" }}</a>
<a href="{{ .Paginator.Next.URL }}" rel="next" class="pager__item pager__item--next">{{ i18n "pager_next" }}<span aria-hidden="true"> »</span></a>
{{ end -}}
</nav>
{{ end -}}
{{ end -}}

View file

@ -1,4 +1,4 @@
{{ $main_options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" false "includePaths" (slice "assets/sass/lib/typey/stylesheets")) -}}
{{ $main_options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" false "transpiler" (site.Params.sassTranspiler | default "libsass")) -}}
{{ if eq hugo.Environment "development" -}}
{{ $main_options = merge $main_options (dict "outputStyle" "nested" "enableSourceMap" true) -}}
{{ end -}}