Skip to content

Commit

Permalink
Add virtual permalink URLs for photos without galleries
Browse files Browse the repository at this point in the history
  • Loading branch information
nhoizey committed Jan 2, 2024
1 parent 9e58011 commit 101a301
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
3 changes: 1 addition & 2 deletions eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ module.exports = function (eleventyConfig) {
)
.addPassthroughCopy('src/ui')
.addPassthroughCopy('src/robots.txt')
.addPassthroughCopy('src/favicon.ico')
.addPassthroughCopy('src/_redirects');
.addPassthroughCopy('src/favicon.ico');

eleventyConfig.setUseGitIgnore(false);
eleventyConfig.addWatchTarget('./ui/');
Expand Down
2 changes: 1 addition & 1 deletion src/_layouts/galleries.njk
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

{% set sub_galleries = collections.photo_galleries | sub_galleries(gallery_root) %}
{% if sub_galleries | length %}
<p>See <a href="./all/">all photos below gallery “{{ title }}”</a>.</p>
<p>See <a href="./all/">all photos below gallery “{{ title }} on a single page</a>.</p>

{{ css('components/gallery_content', build.env) }}
<div class="gallery__content">
Expand Down
4 changes: 0 additions & 4 deletions src/_redirects

This file was deleted.

13 changes: 13 additions & 0 deletions src/_redirects.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: false
permalink: _redirects
---
/ui/thumbnails/:sprites_signature/sprite.png /ui/thumbnails/sprite.png 302
/ui/thumbnails/:sprites_signature/[email protected] /ui/thumbnails/[email protected] 302

/galleries/nature/* /galleries/:splat 301

# Redirect photo page to a location in galleries
{% for photo in collections.unique_photos %}
/photos/{{ photo.page.fileSlug }}/ {{ site.url }}{{ photo.url }} 302
{%- endfor -%}

0 comments on commit 101a301

Please sign in to comment.