Rather than tightly coupling a gallery to one Hexo theme, this approach builds it as standalone HTML and embeds it in a normal page.
Create the page:
1 | hexo new page photos |
Add a menu entry in the theme configuration:
1 | menu: |
Embed the standalone gallery in source/photos/index.md:
1 | <iframe style="max-width:100%" frameborder="0" width="100%" height="750" src="/net/photos/index.html"></iframe> |
Place the gallery under the theme or site source directory, for example source/net/photos/. Its primary index.html links to individual album pages. Each album displays thumbnails and a modal:
1 | <div class="gallery"> |
1 | document.addEventListener('DOMContentLoaded', () => { |
Use CSS grid or flexbox for covers and thumbnails, object-fit: cover for consistent cropping, and a fixed full-screen overlay for the modal. Because the gallery is standalone, it can be moved when the Hexo theme changes.