mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02:00
feat: add support for widget container config
Requires widget to have corresponding config file at `widgets/<name>-config.html`
This commit is contained in:
parent
182c09f49d
commit
3623959e65
1 changed files with 6 additions and 0 deletions
|
@ -92,6 +92,12 @@
|
||||||
|
|
||||||
{{ $widget_class := printf "wg-%s" (replace (replace $widget "." "-") "_" "-") }}
|
{{ $widget_class := printf "wg-%s" (replace (replace $widget "." "-") "_" "-") }}
|
||||||
|
|
||||||
|
{{ $widget_config_file := printf "widgets/%s-config.html" $widget }}
|
||||||
|
{{ if templates.Exists $widget_config_file }}
|
||||||
|
{{ $cfg := partial $widget_config_file $widget_args }}
|
||||||
|
{{ $use_container = $cfg.use_container }}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
<section id="{{$hash_id}}" class="home-section {{$widget_class}} {{if $bg.text_color_light}}dark{{end}} {{if $bg.image}} bg-image{{if ($bg.image_parallax | default true) }} parallax{{end}}{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}>
|
<section id="{{$hash_id}}" class="home-section {{$widget_class}} {{if $bg.text_color_light}}dark{{end}} {{if $bg.image}} bg-image{{if ($bg.image_parallax | default true) }} parallax{{end}}{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}>
|
||||||
{{if $use_container}}<div class="container">{{end}}
|
{{if $use_container}}<div class="container">{{end}}
|
||||||
{{ partial $widget_path $widget_args }}
|
{{ partial $widget_path $widget_args }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue