From bb65a0858d66defea662ef65537ccdbc8b1b9819 Mon Sep 17 00:00:00 2001 From: William Kearney Date: Mon, 15 Jun 2026 16:03:39 +0200 Subject: [PATCH] Add a Recently Added Entry on the home page This PR adds the [ABlog](https://ablog.readthedocs.io) extension, which treats the Gallery posts more like a blog. Thus they can have dates and some metadata associated with them, and we can use this metadata in various ways. Here I have introduced a "Recently Added" section, that highlights the most recently added notebook. Other types of things we could do with this: - Highlight any other notebooks of particular interest - Use tags to group notebooks together - Replace the python/matlab directories with tags - List gallery entries by author - Make other blog posts or updates either here in the Gallery or elsewhere in the TT3 website. I have currently added my Roan Plateau notebook and Boris's first GraphFlood notebook (not #43) as "posts". The remaining Python notebooks can also be added as posts. This is not quite an optimal solution at the moment for reasons discussed below, but I wanted to present it as a possibility for restructuring things a little bit. You need to add some metadata in the form of a raw reStructuredText cell to the top of the notebook. This is a little tricky for potential contributors because you have to fiddle with the notebook metadata. I also have not figured out a good way to add this cell to MATLAB Live Scripts. We'll need to do some postprocessing, like we handle images at the moment. I am not sure of a good way to embed the metadata in the Live Script so that we can access it with a filter program. The post authors are maintained in a directory in conf.py. Every time a new author contributes, they'll need to add themselves to the directory. All of the posts contributed by a given author are collected in an automatically generated page, and the author's homepage is linked, which is rather nice. The authors and publication date shows up in the left sidebar. I don't know if it is possible to make them appear in the post itself. If we figure that out, we could replace the typical "Authors" section with this information. Signed-off-by: William Kearney --- conf.py | 19 ++++++++- index.rst | 9 ++++ notebooks/python/graphflood/graphflood.ipynb | 28 ++++++++++++- .../python/roan-plateau/roan-plateau.ipynb | 42 +++++++++++++++++-- requirements.txt | 2 +- 5 files changed, 92 insertions(+), 8 deletions(-) diff --git a/conf.py b/conf.py index 4386d6f..7e1f41c 100644 --- a/conf.py +++ b/conf.py @@ -14,7 +14,10 @@ # -- General configuration --------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration -extensions = ['nbsphinx'] +extensions = ['nbsphinx', + 'ablog', + 'sphinx.ext.intersphinx' + ] templates_path = ['_templates'] exclude_patterns = ['build'] @@ -39,9 +42,21 @@ html_sidebars = { "index" : [], "notebooks/index" : [], - #"notebooks/**" : ["sbt-sidebar-nav.html"] + "notebooks/**" : ["sidebar-collapse", + "ablog/postcard", + "sidebar-nav-bs", + ] } html_sourcelink_suffix = '' nbsphinx_allow_errors = True + +post_auto_image = 1 +post_auto_excerpt=0 + +blog_authors = { + 'wkearn': ('William Kearney', 'https://wskearney.com'), + 'wschwanghart': ('Wolfgang Schwanghart', 'https://topotoolbox.wordpress.com'), + 'bgailleton': ('Boris Gailleton', 'https://bgailleton.github.io'), +} diff --git a/index.rst b/index.rst index 8c6b3fc..0b18464 100644 --- a/index.rst +++ b/index.rst @@ -18,6 +18,15 @@ can use the templates for :doc:`Python ` and :doc:`MATLAB ` as a starting point. +Recently added +-------------- +.. postlist:: 1 + :format: {title} by {author} on {date} + :excerpts: + :sort: + +All Entries +----------- .. nblinkgallery:: :glob: diff --git a/notebooks/python/graphflood/graphflood.ipynb b/notebooks/python/graphflood/graphflood.ipynb index fa81114..9a91ac8 100644 --- a/notebooks/python/graphflood/graphflood.ipynb +++ b/notebooks/python/graphflood/graphflood.ipynb @@ -1,12 +1,36 @@ { "cells": [ + { + "cell_type": "markdown", + "id": "03b6e919-7f34-429c-8dd4-4d340d493e88", + "metadata": {}, + "source": [ + "# GraphFlood: a large-scale hydrodynamics module for TopoToolbox" + ] + }, + { + "cell_type": "raw", + "id": "41b2d54d-3033-4643-b0cc-64cc9ff5e66d", + "metadata": { + "editable": true, + "raw_mimetype": "text/x-rst", + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "source": [ + ".. post:: 23 April 2026\n", + " :author: bgailleton\n", + " :image: 1\n", + " :exclude:" + ] + }, { "cell_type": "markdown", "id": "aa000001-0000-0000-0000-000000000001", "metadata": {}, "source": [ - "# GraphFlood: a large-scale hydrodynamics module for TopoToolbox\n", - "\n", "## Author\n", "\n", "- Boris Gailleton, Université de Rennes, ([homepage](https://bgailleton.github.io/))\n", diff --git a/notebooks/python/roan-plateau/roan-plateau.ipynb b/notebooks/python/roan-plateau/roan-plateau.ipynb index 97b42e1..6f710c9 100644 --- a/notebooks/python/roan-plateau/roan-plateau.ipynb +++ b/notebooks/python/roan-plateau/roan-plateau.ipynb @@ -1,12 +1,48 @@ { "cells": [ + { + "cell_type": "markdown", + "id": "e0972df0-4318-45d7-828f-00b1588fd5dd", + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "source": [ + "# Fluvial knickpoints on the Roan Plateau (Python)" + ] + }, + { + "cell_type": "raw", + "id": "71c47f6f-21db-429b-a774-0413e3809937", + "metadata": { + "editable": true, + "raw_mimetype": "text/x-rst", + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, + "source": [ + ".. post:: 2 June, 2026\n", + " :author: wkearn, wschwanghart\n", + " :image: 10\n", + " :exclude:" + ] + }, { "cell_type": "markdown", "id": "0", - "metadata": {}, + "metadata": { + "editable": true, + "slideshow": { + "slide_type": "" + }, + "tags": [] + }, "source": [ - "# Fluvial knickpoints on the Roan Plateau (Python)\n", - "\n", "## Authors\n", "\n", "Wolfgang Schwanghart, University of Potsdam, FU Berlin ([homepage](https://topotoolbox.wordpress.com), [GitHub](https://github.com/wschwanghart))\n", diff --git a/requirements.txt b/requirements.txt index 5cc86b1..2bb98fe 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ topotoolbox>=0.0.12 sphinx -sphinx-book-theme +pydata-sphinx-theme nbsphinx notebook cmocean