Files
immich-folio/app/robots.ts
Ralksta a813433891 release: v0.13.0 (#535)
Twenty-nine commits since v0.12.0. See CHANGELOG.md for the full list
and the upgrade notes.

Ten additions — the SEO package (site URL, robots.txt, sitemap.xml,
JSON-LD), slideshow mode, opt-in original downloads, copy-link,
previous/next album navigation, alt text from the Immich description,
per-album location precision, the update notice, a Help tab, and a
subpage cover grid separate from its photo grid. Two fixes: CJK album
slugs, and the lightbox control bar.

Photo of the Day (#476) was built on `dev` and reverted as not planned;
it never appears in a release.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01DmsHVRL9yQvckUB1ZpVWre

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: ralksta <ralksta@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 10:08:12 +02:00

42 lines
1.3 KiB
TypeScript

import type { MetadataRoute } from 'next';
import { getConfigOrNull } from '@/lib/config';
import { isSiteLocked } from '@/lib/auth';
import { absoluteUrl } from '@/lib/siteUrl';
/**
* robots.txt (#472).
*
* Reflects the same decision `generateMetadata()` already makes for the robots
* meta tag, so the two cannot disagree: a site behind a password, or one that
* asked not to be indexed, is closed to crawlers here as well.
*/
export const dynamic = 'force-dynamic';
export default function robots(): MetadataRoute.Robots {
const config = getConfigOrNull();
// Nothing configured yet — the setup screen is not worth crawling.
if (!config) {
return { rules: { userAgent: '*', disallow: '/' } };
}
if (isSiteLocked() || config.seo.noIndex) {
return { rules: { userAgent: '*', disallow: '/' } };
}
const sitemap = absoluteUrl(config.siteUrl, '/sitemap.xml');
return {
rules: {
userAgent: '*',
allow: '/',
// The image proxy, the admin panel and the installer have nothing to
// offer a crawler and plenty to cost the Immich server behind them.
disallow: ['/api/', '/admin', '/install'],
},
// Omitted rather than guessed when no site URL is configured: robots.txt
// requires an absolute sitemap URL.
...(sitemap ? { sitemap } : {}),
};
}