mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-07-26 19:15:16 +02:00
widgets: Direct inclusion of widgets (#45)
Replace the long if-else block in index.html with a direct inclusion of the widgets. Signed-off-by: Stephan Kulla <git.mail@kulla.me>
This commit is contained in:
parent
16a18a9317
commit
db9dcf6055
6 changed files with 27 additions and 33 deletions
|
@ -7,7 +7,7 @@ draft = false
|
||||||
|
|
||||||
title = "Recent Publications"
|
title = "Recent Publications"
|
||||||
subtitle = ""
|
subtitle = ""
|
||||||
widget = "pubs"
|
widget = "publications"
|
||||||
|
|
||||||
# Order that this section will appear in.
|
# Order that this section will appear in.
|
||||||
weight = 20
|
weight = 20
|
||||||
|
|
|
@ -8,7 +8,7 @@ draft = false
|
||||||
|
|
||||||
title = "Selected Publications"
|
title = "Selected Publications"
|
||||||
subtitle = ""
|
subtitle = ""
|
||||||
widget = "pubs_selected"
|
widget = "publications_selected"
|
||||||
|
|
||||||
# Order that this section will appear in.
|
# Order that this section will appear in.
|
||||||
weight = 10
|
weight = 10
|
||||||
|
|
|
@ -7,21 +7,9 @@
|
||||||
<!-- Widgets -->
|
<!-- Widgets -->
|
||||||
{{ $pubs_selected_len := len (where (where .Data.Pages "Type" "publication") ".Params.selected" true) }}
|
{{ $pubs_selected_len := len (where (where .Data.Pages "Type" "publication") ".Params.selected" true) }}
|
||||||
{{ range $index, $page := where .Data.Pages "Type" "home" }}
|
{{ range $index, $page := where .Data.Pages "Type" "home" }}
|
||||||
{{ if eq $page.Params.widget "about" }}
|
{{ $params := dict "root" $ "page" $page "pubs_selected_len" $pubs_selected_len }}
|
||||||
{{ partial "widgets/about" $page }}
|
{{ $widget := printf "widgets/%s.html" ( or $page.Params.widget "custom" ) }}
|
||||||
{{ else if eq $page.Params.widget "pubs_selected" }}
|
{{ partial $widget $params }}
|
||||||
{{ partial "widgets/publications_selected" (dict "root" $ "page" $page "pubs_selected_len" $pubs_selected_len) }}
|
|
||||||
{{ else if eq $page.Params.widget "pubs" }}
|
|
||||||
{{ partial "widgets/publications" (dict "root" $ "page" $page "pubs_selected_len" $pubs_selected_len) }}
|
|
||||||
{{ else if eq $page.Params.widget "posts" }}
|
|
||||||
{{ partial "widgets/posts" (dict "root" $ "page" $page) }}
|
|
||||||
{{ else if eq $page.Params.widget "projects" }}
|
|
||||||
{{ partial "widgets/projects" (dict "root" $ "page" $page) }}
|
|
||||||
{{ else if eq $page.Params.widget "contact" }}
|
|
||||||
{{ partial "widgets/contact.html" $page }}
|
|
||||||
{{ else }}
|
|
||||||
{{ partial "widgets/custom.html" $page }}
|
|
||||||
{{ end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
<!-- Page Footer -->
|
<!-- Page Footer -->
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
{{ $ := .root }}
|
||||||
|
{{ $page := .page }}
|
||||||
|
|
||||||
<!-- About/Biography widget -->
|
<!-- About/Biography widget -->
|
||||||
<section id="bio" class="home-section">
|
<section id="bio" class="home-section">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
@ -7,17 +10,17 @@
|
||||||
<div id="profile">
|
<div id="profile">
|
||||||
|
|
||||||
<div class="portrait" itemprop="image"
|
<div class="portrait" itemprop="image"
|
||||||
style="background-image: url('{{ .Site.BaseURL }}img/{{ .Site.Params.avatar }}');">
|
style="background-image: url('{{ $.Site.BaseURL }}img/{{ $.Site.Params.avatar }}');">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="portrait-title">
|
<div class="portrait-title">
|
||||||
<h2 itemprop="name">{{ .Site.Params.name }}</h2>
|
<h2 itemprop="name">{{ $.Site.Params.name }}</h2>
|
||||||
<h3 itemprop="jobTitle">{{ .Site.Params.role }}</h3>
|
<h3 itemprop="jobTitle">{{ $.Site.Params.role }}</h3>
|
||||||
{{ with .Site.Params.organization }}<h3 itemprop="worksFor">{{ . }}</h3>{{ end }}
|
{{ with $.Site.Params.organization }}<h3 itemprop="worksFor">{{ . }}</h3>{{ end }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul class="social-icon" aria-hidden="true">
|
<ul class="social-icon" aria-hidden="true">
|
||||||
{{ range .Site.Params.social }}
|
{{ range $.Site.Params.social }}
|
||||||
<li>
|
<li>
|
||||||
<a href="{{ .link }}">
|
<a href="{{ .link }}">
|
||||||
<i class="{{ .icon_pack | default "fa" }} {{ .icon_pack | default "fa" }}-{{ .icon }} big-icon"></i>
|
<i class="{{ .icon_pack | default "fa" }} {{ .icon_pack | default "fa" }}-{{ .icon }} big-icon"></i>
|
||||||
|
@ -33,11 +36,11 @@
|
||||||
|
|
||||||
<div class="col-xs-12 col-md-8" itemprop="description">
|
<div class="col-xs-12 col-md-8" itemprop="description">
|
||||||
|
|
||||||
{{ .Content }}
|
{{ $page.Content }}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
{{ with .Params.interests }}
|
{{ with $page.Params.interests }}
|
||||||
<div class="col-sm-5">
|
<div class="col-sm-5">
|
||||||
<h3>{{ .title | default "Interests" | markdownify }}</h3>
|
<h3>{{ .title | default "Interests" | markdownify }}</h3>
|
||||||
<ul class="ul-interests">
|
<ul class="ul-interests">
|
||||||
|
@ -48,7 +51,7 @@
|
||||||
</div>
|
</div>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .Params.education }}
|
{{ with $page.Params.education }}
|
||||||
<div class="col-sm-7">
|
<div class="col-sm-7">
|
||||||
<h3>{{ .title | default "Education" | markdownify }}</h3>
|
<h3>{{ .title | default "Education" | markdownify }}</h3>
|
||||||
<ul class="ul-edu fa-ul">
|
<ul class="ul-edu fa-ul">
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
|
{{ $ := .root }}
|
||||||
|
{{ $page := .page }}
|
||||||
|
|
||||||
<!-- Contact widget -->
|
<!-- Contact widget -->
|
||||||
<section id="contact" class="home-section">
|
<section id="contact" class="home-section">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-xs-12 col-md-4 section-heading">
|
<div class="col-xs-12 col-md-4 section-heading">
|
||||||
<h1>{{ with .Title }}{{ . | markdownify }}{{ end }}</h1>
|
<h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1>
|
||||||
{{ with .Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
{{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-8">
|
<div class="col-xs-12 col-md-8">
|
||||||
{{ with .Content }}<p>{{ . | markdownify }}</p>{{ end }}
|
{{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }}
|
||||||
|
|
||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
|
|
||||||
{{ with .Site.Params.email }}
|
{{ with $.Site.Params.email }}
|
||||||
<li>
|
<li>
|
||||||
<i class="fa fa-envelope fa-fw big-icon" aria-hidden="true"></i>
|
<i class="fa fa-envelope fa-fw big-icon" aria-hidden="true"></i>
|
||||||
{{ if and (isset $.Params "autolink") (eq $.Params.autolink false) }}
|
{{ if and (isset $.Params "autolink") (eq $.Params.autolink false) }}
|
||||||
|
@ -23,7 +26,7 @@
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .Site.Params.keybase }}
|
{{ with $.Site.Params.keybase }}
|
||||||
<li>
|
<li>
|
||||||
<i class="fa fa-lock fa-fw big-icon" aria-hidden="true"></i>
|
<i class="fa fa-lock fa-fw big-icon" aria-hidden="true"></i>
|
||||||
<span>
|
<span>
|
||||||
|
@ -32,7 +35,7 @@
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .Site.Params.phone }}
|
{{ with $.Site.Params.phone }}
|
||||||
<li>
|
<li>
|
||||||
<i class="fa fa-phone fa-fw big-icon" aria-hidden="true"></i>
|
<i class="fa fa-phone fa-fw big-icon" aria-hidden="true"></i>
|
||||||
{{ if and (isset $.Params "autolink") (eq $.Params.autolink false) }}
|
{{ if and (isset $.Params "autolink") (eq $.Params.autolink false) }}
|
||||||
|
@ -43,7 +46,7 @@
|
||||||
</li>
|
</li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ with .Site.Params.address }}
|
{{ with $.Site.Params.address }}
|
||||||
<li>
|
<li>
|
||||||
<i class="fa fa-map-marker fa-fw big-icon" aria-hidden="true"></i>
|
<i class="fa fa-map-marker fa-fw big-icon" aria-hidden="true"></i>
|
||||||
<span>{{ . }}</span>
|
<span>{{ . }}</span>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{{ $page := . }}
|
{{ $page := .page }}
|
||||||
{{ $title_words := split $page.Title " " }}
|
{{ $title_words := split $page.Title " " }}
|
||||||
|
|
||||||
<!-- Custom widget -->
|
<!-- Custom widget -->
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue