Commit Graph
13 Commits
Author SHA1 Message Date
George Cushen d9ff93a1c2 feat: make media library dir configurable
Move default media library from static/img/ to static/media/ as it can now contain audio, video, and other kinds of media in addition to images.

BREAKING CHANGE:
Either rename your site's static/img/ to static/media/ (and update any references to this folder in your Markdown files);

Or, add `media_dir = "img"` to `params.toml` to continue using the legacy location.
2020-07-29 18:54:28 +01:00
George Cushen dbeb7fd871 feat: enable rich text in figure lightbox captions
By adding `safeHTMLAttr`, similarly to the gallery shortcode.

Enables links to show within the figure lightbox, for example.

Close #1706
2020-05-28 21:52:04 +01:00
beckerjohannes f9794e9f09 feat: add ID to figures to make them linkable (#1475)
Generates linkable IDs for figures by anchorizing the caption and namespacing the figure ID by prefixing it with `figure-` to help prevent conflicts with other existing IDs.
2020-03-06 19:57:33 +00:00
George Cushen 7b4470ebb5 fix: 55228b7ade
Fix figure images not loading when not within page bundle.
2020-01-24 02:08:50 +00:00
George Cushen 55228b7ade fix: lazy loading causing inaccurate anchor scrolling + link highlighting
As of a recent update, gallery and figure images are lazy loaded. However, lazy loading without initial sizes defined can lead to inaccurate anchor scrolling and active link highlighting as the anchor offset changes after an uncached image occurring before the anchor is lazily loaded.

See https://github.com/gcushen/hugo-academic/issues/1199#issuecomment-577293818
Fix #1199
2020-01-23 23:44:08 +00:00
George Cushen 361707f4fd feat: lazy load figures and gallery images
The proportion of image data in the typical payload of a website can be significant. Lazy loading is a solution that lowers initial page payload and load time, without removing content. Non-critical resources are instead loaded at the moment that they are needed.

Also, load MathJax async in head if required, rather than at end of body.

Close #1106
2019-12-18 14:33:22 +00:00
George Cushen 2192b11d04 style: center figure captions
Since figures are now centered.
2019-09-14 19:41:11 +01:00
George Cushen c163931702 fix: HTML5 validation errors on Demo site
Fix #1197
2019-09-11 17:25:12 +01:00
George Cushen 72a5e5b8c0 feat(shortcode): enable figure lightbox by default
Add "lightbox"="false" to shortcode args to disable
2019-07-23 20:56:40 +01:00
Russell J. Hewett 3e6ab0cf69 feat(shortcode): add lightbox option to Figure (#1146)
Example: `{{< figure src="example.png" lightbox="true" >}}`
2019-06-19 23:16:35 +01:00
George Cushen 9bcecc7b25 shortcodes: Update figure and video to support files within page dir
To reference file in page folder, simply use
`{{< figure src="a.png" >}}`

To reference file from `static/img/` media library, set `library=1`
in shortcode. E.g. `{{< figure src="a.png" library=1 >}}`

See #708
2018-09-23 23:10:34 +01:00
George Cushen 09674dd538 figure shortcode: Fix caption style
See #328
2018-04-21 23:19:43 +01:00
George Cushen f23526e55d figure shortcode: Support i18n and unnumbered captions
- Figures are now unnumbered by default
- To number a figure, use the form:
  - `{{< figure src="image.jpg" title="Caption" numbered="true" >}}`
- Add i18n translation for "Figure" in captions
- Update English and Chinese language packs

Close #328 and #513
2018-04-21 10:35:15 +01:00