-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
Description
The titles mapping in nbsite_gallery_conf is only used for gallery card labels/thumbnails but not for the actual page title or sidebar entry.
For example, Panel's doc/conf.py defines:
'titles': {
'Vega': 'Altair & Vega',
'DeckGL': 'PyDeck & Deck.gl',
'ECharts': 'PyEcharts & ECharts',
...
}The gallery cards correctly show "Altair & Vega", but the generated page title and sidebar still show "Vega" (derived from the filename Vega.ipynb).
Root Cause
Both generate_item_md (line 340) and generate_item_rst (line 421) in gallery/gen.py derive the title from the filename only:
name = basename[:-(len(extension)+1)]
title = ' '.join([n[0].capitalize()+n[1:] for n in name.replace('_', ' ').split(' ')])The titles mapping from content.get('titles', {}) is available via gallery_conf but never consulted in these functions.
Proposed Fix
In both generate_item_md and generate_item_rst, look up the titles mapping before falling back to the filename-derived title:
content = gallery_conf['galleries'][page]
titles = content.get('titles', {})
title = titles.get(name, ' '.join([n[0].capitalize()+n[1:] for n in name.replace('_', ' ').split(' ')]))Related
- Change name of the Vega panes page to "Altair & Vega" holoviz/panel#8191 - Change name of the Vega panes page to "Altair & Vega"
- Change names of the Vega panes page to "Altair & Vega" holoviz/panel#3490 - Original issue requesting the rename
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels