From 5a99e80e0f4ef69af682460031c5f9d19096ac06 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Tue, 11 Jun 2024 16:00:32 +0100 Subject: [PATCH] website: improve widgets (#1816) - docs: use pre-release theme - website: arbitrary number of widgets, move content up (fixes #1815) --- docs/docs_environment.yml | 2 +- docs/pages/_layouts/frontpage.html | 105 +++++++++++++++++++++++++++++ docs/pages/index.md | 10 ++- 3 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 docs/pages/_layouts/frontpage.html diff --git a/docs/docs_environment.yml b/docs/docs_environment.yml index a8de76581f..ea238cc225 100644 --- a/docs/docs_environment.yml +++ b/docs/docs_environment.yml @@ -36,4 +36,4 @@ dependencies: # TODO: remove after https://github.com/pydata/pydata-sphinx-theme/pull/1795 is released - pip - pip: - - git+https://github.com/TomographicImaging/pydata-sphinx-theme@fix-version-switcher-dirhtml#egg=pydata-sphinx-theme + - git+https://github.com/pydata/pydata-sphinx-theme diff --git a/docs/pages/_layouts/frontpage.html b/docs/pages/_layouts/frontpage.html new file mode 100644 index 0000000000..c17109d2c8 --- /dev/null +++ b/docs/pages/_layouts/frontpage.html @@ -0,0 +1,105 @@ +--- +layout: default +format: frontpage +--- + +
+
+
+
+
+
+ + +{% comment %} +* +* Main page content +* +{% endcomment %} +
+ {{ content }} +
+ + +{% comment %} +* +* Widgets (multi-column cards) +* +{% endcomment %} +
+ {% if page.widgets %} + {% for widget in page.widgets %} + {% include _frontpage-widget.html widget=widget %} + {% endfor %} + {% endif %} +
+ + + +{% comment %} +* +* First check, if there is a call for action-button +* +{% endcomment %} +{% if page.callforaction.url contains 'http' %} +{% assign url = '' %} +{% else %} +{% capture url %}{{ site.url }}{{ site.baseurl }}{% endcapture %} +{% endif %} +{% if page.callforaction %} +
+ +
+{% endif %} + + + +{% comment %} +* +* First check, if there are any posts at all +* +{% endcomment %} + +{% unless site.posts == empty %} +
+
+ {% for post in site.posts limit:1 %} + {% if post.image.homepage %} +

+ {{ page.title | escape_once }} +

+ + {% if post.image.caption_url and post.image.caption %} +

+ {{ post.image.caption }} +

+ {% endif %} + {% else post.image.homepage == NULL %} +

{{ site.data.language.new_blog_entries }}

+ {% endif %} + {% endfor %} +
+
+ + +
+
+ {% for post in site.posts limit:1 %} + {% if post.subheadline %}

{{ post.subheadline }}

{% endif %} +

{{ post.title }}

+

+ {% if post.meta_description %}{{ post.meta_description | strip_html | escape }}{% else post.teaser %}{{ post.teaser | strip_html | escape }}{% endif %} + {{ site.data.language.read_more }} +

+ {% endfor %} +
+ + +
+

{{ site.data.language.more_articles }}

+ {% include list-posts entries='3' offset='1' %} +
+
+{% endunless %} diff --git a/docs/pages/index.md b/docs/pages/index.md index b14adacdca..b49384b290 100644 --- a/docs/pages/index.md +++ b/docs/pages/index.md @@ -4,8 +4,8 @@ layout: frontpage header: image_fullwidth: https://ccpi.ac.uk/wp-content/uploads/2022/08/front-page-1125x800.png # ideally 600x80 pixels title: 'CIL - Core Imaging Library' -widget1: - title: Examples +widgets: +- title: Examples url: 'https://mybinder.org/v2/gh/TomographicImaging/CIL-Demos/HEAD?urlpath=lab/tree/binder%2Findex.ipynb' image: https://ccpi.ac.uk/wp-content/uploads/2022/04/walnut_training.png text: > @@ -13,15 +13,13 @@ widget1:
Some examples without any local installation are provided in Binder. Please click the button below to try them immediately in your browser. -widget2: - title: CIL Documentation +- title: CIL Documentation url: '/nightly/' image: https://ccpi.ac.uk/wp-content/uploads/2022/11/CIL-logo-RGB.svg text: > CIL has a live documentation which gets updated regularly and built nightly. We suggest to download and read the open access articles below, which provide very detailed information about CIL structure and usage. -widget3: - title: Papers +- title: Papers url: 'https://github.com/TomographicImaging/Paper-2021-RSTA-CIL-Part-II' image: https://ccpi.ac.uk/wp-content/uploads/2022/10/RSTA_cover.png text: >