diff options
author | Derek Severin <severinderek@gmail.com> | 2021-09-03 12:22:14 +0300 |
---|---|---|
committer | Derek Severin <severinderek@gmail.com> | 2021-09-03 12:22:14 +0300 |
commit | b3666342c47675291899753c5de07ccda69d206e (patch) | |
tree | e164f09a30c23ce5af3fd4e0050e572bb2ef1922 | |
parent | ec37a055bbcab3c3d788a2ada9407bc3148b21fe (diff) |
Separate number of columns for home and list
-rw-r--r-- | TODO/TODO.md | 8 | ||||
-rw-r--r-- | layouts/partials/limage.html (renamed from layouts/_default/limage.html) | 41 | ||||
-rw-r--r-- | layouts/partials/pages/lists.html | 3 | ||||
-rw-r--r-- | layouts/partials/sections/projects.html | 2 |
4 files changed, 24 insertions, 30 deletions
diff --git a/TODO/TODO.md b/TODO/TODO.md index 23e46b4..feb3b16 100644 --- a/TODO/TODO.md +++ b/TODO/TODO.md @@ -5,6 +5,7 @@ - add CSS+layout variables changes in README + exampleSite config.toml! !!!! +- [ ] Remove all external dependencies (eg photoswipe cdn), or at least make fallback alternatives - [ ] Complete README.md file => What to add? - [ ] Reference "Minimal Academic" theme for the sidebar stuff? (if not done) @@ -205,13 +206,6 @@ - [ ] li.html - [ ] Change layout of links, and put everything in the "a" tag. => Do something similar to "project-box". - - [ ] limage.html - - [ ] Determine number of columns and offsets based on content.<br> - For - ```html - <div class="col-lg-4 col-sm-6"> - ``` - => Could use "get-number-columns.html". - [ ] single.html - [ ] Keep aria-hidden?<br> => And check if needed anywhere else. diff --git a/layouts/_default/limage.html b/layouts/partials/limage.html index d60acc1..77624dc 100644 --- a/layouts/_default/limage.html +++ b/layouts/partials/limage.html @@ -1,49 +1,50 @@ {{/* Get the number of columns from config */}} {{ $col_lg := "col-lg-2" }} -{{ with $.Site.Params.projects.nb_columns }} - {{ $nb_cols := div 12 (int .) }} - {{ $col_lg = print "col-lg-" $nb_cols }} -{{ end }} {{ $col_sm := "col-sm-3" }} -{{ with $.Site.Params.projects.nb_columns_small }} - {{ $nb_cols := div 12 (int .) }} - {{ $col_sm = print "col-sm-" $nb_cols }} -{{ end }} {{ $col_xs := "col-xs-6" }} -{{ with $.Site.Params.projects.nb_columns_xsmall }} - {{ $nb_cols := div 12 (int .) }} - {{ $col_xs = print "col-xs-" $nb_cols }} +{{ with .data }} + {{ with .nb_columns }} + {{ $nb_cols := div 12 (int .) }} + {{ $col_lg = print "col-lg-" $nb_cols }} + {{ end }} + {{ with .nb_columns_small }} + {{ $nb_cols := div 12 (int .) }} + {{ $col_sm = print "col-sm-" $nb_cols }} + {{ end }} + {{ with .nb_columns_xsmall }} + {{ $nb_cols := div 12 (int .) }} + {{ $col_xs = print "col-xs-" $nb_cols }} + {{ end }} {{ end }} {{ $class := print $col_lg " " $col_sm " " $col_xs }} <div class="{{ $class }}"> - {{ $path := replace .File.Dir "\\" "/" }} + {{ $path := replace .context.File.Dir "\\" "/" }} <a href="/{{ $path }}" class="project-box project-link"> - {{ $image_file := or .Params.cover_image .Params.small_image }} + {{ $image_file := or .context.Params.cover_image .context.Params.small_image }} {{ if $image_file }} - {{ $image := .Resources.GetMatch $image_file }} + {{ $image := .context.Resources.GetMatch $image_file }} {{ with $image }} <img src="{{ .Permalink }}" class="img-responsive" alt="{{ .Name }}"> {{ end }} {{ end }} - <div class="project-box-caption"> <div class="project-box-caption-content"> - {{ with .Title }} + {{ with .context.Title }} <div class="project-name"> {{ . }} </div> {{ end }} - {{ with .Params.subtitle }} + {{ with .context.Params.subtitle }} <div class="project-category"> {{ . }} </div> {{ end }} - {{ if .Params.startDate }} + {{ if .context.Params.startDate }} <div class="project-date"> - {{ partial "time-period.html" (dict "startDate" .Params.startDate "endDate" .Params.endDate) }} + {{ partial "time-period.html" (dict "startDate" .context.Params.startDate "endDate" .context.Params.endDate) }} </div> {{ end }} </div> </div> </a> -</div> +</div>
\ No newline at end of file diff --git a/layouts/partials/pages/lists.html b/layouts/partials/pages/lists.html index 8ef461e..6858c95 100644 --- a/layouts/partials/pages/lists.html +++ b/layouts/partials/pages/lists.html @@ -12,7 +12,7 @@ <div class="container-fluid"> <div class="row no-gutter"> {{ range (.Scratch.Get "list") }} - {{ .Render "limage" }} + {{ partial "limage.html" (dict "context" . "data" $.Site.Params.projects.list) }} {{ end }} </div> </div> @@ -22,7 +22,6 @@ </div> {{ end }} {{ end }} - {{/* List posts (default value is true) */}} {{ if (or (not (isset .Params "showposts")) (.Params.showposts)) }} {{ if .Pages }} diff --git a/layouts/partials/sections/projects.html b/layouts/partials/sections/projects.html index c35847f..a114709 100644 --- a/layouts/partials/sections/projects.html +++ b/layouts/partials/sections/projects.html @@ -12,7 +12,7 @@ {{/* Sort the list */}} {{ partial "utils/ordered-list.html" (dict "list" .Sections "params" .Params "scratch" .Scratch) }} {{ range (.Scratch.Get "list") }} - {{ .Render "limage" }} + {{ partial "limage.html" (dict "context" . "data" $.Site.Params.projects.home) }} {{ end }} {{ .Scratch.Delete "list" }} {{ end }} |