From 829b552cd9397737a44af47ced2d5ec15f65808e Mon Sep 17 00:00:00 2001 From: Ladislav Prskavec Date: Sat, 1 Jun 2024 10:12:18 +0200 Subject: [PATCH 1/5] Fix theme from upstream --- themes/academia/layouts/authors/list.html | 3 +- .../layouts/partials/docs_sidebar.html | 5 +- themes/academia/layouts/partials/li_card.html | 4 +- themes/academia/layouts/partials/li_list.html | 6 +- themes/academia/layouts/partials/navbar.html | 4 +- .../layouts/partials/page_links_div.html | 2 +- .../layouts/partials/site_footer.html | 15 ++-- .../academia/layouts/partials/site_head.html | 15 +++- .../layouts/partials/widgets/about.html | 4 +- .../layouts/partials/widgets/pages.html | 2 +- .../academia/layouts/shortcodes/expand.html | 17 ++++ themes/academia/scripts/projectSetup.js | 77 ++++++++++++++++ themes/academia/scripts/themeSetup.js | 87 +++++++++++++++++++ 13 files changed, 214 insertions(+), 27 deletions(-) create mode 100644 themes/academia/layouts/shortcodes/expand.html create mode 100644 themes/academia/scripts/projectSetup.js create mode 100644 themes/academia/scripts/themeSetup.js diff --git a/themes/academia/layouts/authors/list.html b/themes/academia/layouts/authors/list.html index 2176e09..f1280ea 100644 --- a/themes/academia/layouts/authors/list.html +++ b/themes/academia/layouts/authors/list.html @@ -14,7 +14,8 @@

{{ .Title }}

{{/* Show the About widget if an account exists for this user. */}} {{ if .File }} {{ $widget := "widgets/about.html" }} - {{ $username := (path.Base (path.Split .Path).Dir) }}{{/* Alternatively, use `index .Params.authors 0` */}} + {{ $baseExcluded := strings.TrimLeft site.BaseURL .Permalink }} + {{ $username := index (split $baseExcluded "/") 1 }} {{ $params := dict "root" $ "page" . "author" $username }} {{ partial $widget $params }} {{end}} diff --git a/themes/academia/layouts/partials/docs_sidebar.html b/themes/academia/layouts/partials/docs_sidebar.html index 08e5ab1..258ca08 100644 --- a/themes/academia/layouts/partials/docs_sidebar.html +++ b/themes/academia/layouts/partials/docs_sidebar.html @@ -1,7 +1,10 @@ {{ $current_page := . }} {{/* Dynamically load menu for this docs page. */}} -{{ $menu_name := path.Base (path.Split .CurrentSection.File).Dir }} +{{/* {{ $menu_name := path.Base (path.Split .CurrentSection.File).Dir }} */}} +{{ $baseExcluded := strings.TrimLeft site.BaseURL .Permalink }} +{{ $menu_name := index (split $baseExcluded "/") 1 }} + {{ if not (index site.Menus $menu_name) }} {{ errorf "Please define menu items named `menu: %s:` in your %s front matter or define `[[menu.%s]]` in `config/default/menus.toml`. See https://sourcethemes.com/academic/docs/managing-content/#menus" $menu_name .Path $menu_name }} {{ end }} diff --git a/themes/academia/layouts/partials/li_card.html b/themes/academia/layouts/partials/li_card.html index 01a971b..59455b9 100644 --- a/themes/academia/layouts/partials/li_card.html +++ b/themes/academia/layouts/partials/li_card.html @@ -27,7 +27,7 @@ {{ end }}
- {{ $resource := ($item.Resources.ByType "image").GetMatch "*page-featured*" }} + {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }} {{ $anchor := $item.Params.image.focal_point | default "Smart" }} {{ with $resource }} {{ $image := .Fill (printf "918x517 q90 %s" $anchor) }} @@ -78,4 +78,4 @@

{{ end }} - + \ No newline at end of file diff --git a/themes/academia/layouts/partials/li_list.html b/themes/academia/layouts/partials/li_list.html index ecfff48..e670c14 100644 --- a/themes/academia/layouts/partials/li_list.html +++ b/themes/academia/layouts/partials/li_list.html @@ -18,12 +18,10 @@ {{ $show_buttons = true }} {{ end }} -
+
- {{ if eq $item.Type "post" }} -
{{ $item.Summary }}
- {{ end }} + {{ if eq $item.Type "talk" }} diff --git a/themes/academia/layouts/partials/page_links_div.html b/themes/academia/layouts/partials/page_links_div.html index 9d177fc..0decd4d 100644 --- a/themes/academia/layouts/partials/page_links_div.html +++ b/themes/academia/layouts/partials/page_links_div.html @@ -15,7 +15,7 @@ {{ $cite_link = true }} {{ end }} -{{ if $cite_link | or $pdf_link | or .Params.external_link | or .Params.url_preprint | or .Params.url_pdf | or .Params.url_slides | or .Params.url_video | or .Params.url_source | or .Params.url_code | or .Params.url_dataset | or .Params.url_poster | or .Params.url_project | or .Params.links | or .Params.projects | or .Params.slides }} +{{ if $cite_link | or $pdf_link | or .Params.external_link | or .Params.doi | or .Params.url_preprint | or .Params.url_pdf | or .Params.url_slides | or .Params.url_video | or .Params.url_source | or .Params.url_code | or .Params.url_dataset | or .Params.url_poster | or .Params.url_project | or .Params.links | or .Params.projects | or .Params.slides }}