Don't statically generate hidden photos
This commit is contained in:
parent
8d31afbed2
commit
32c3fcc656
@ -7,7 +7,7 @@ import {
|
||||
STATICALLY_OPTIMIZED_PHOTO_CATEGORY_OG_IMAGES,
|
||||
} from '@/app/config';
|
||||
import { GENERATE_STATIC_PARAMS_LIMIT } from '@/photo/db';
|
||||
import { getPhotoIds } from '@/photo/db/query';
|
||||
import { getPublicPhotoIds } from '@/photo/db/query';
|
||||
import { depluralize, pluralize } from '@/utility/string';
|
||||
|
||||
type StaticOutput = 'page' | 'image';
|
||||
@ -23,7 +23,9 @@ export const staticallyGeneratePhotosIfConfigured = (type: StaticOutput) =>
|
||||
(type === 'image' && STATICALLY_OPTIMIZED_PHOTO_CATEGORY_OG_IMAGES)
|
||||
)
|
||||
? async () => {
|
||||
const photos = await getPhotoIds({ limit: GENERATE_STATIC_PARAMS_LIMIT });
|
||||
const photos = await getPublicPhotoIds({
|
||||
limit: GENERATE_STATIC_PARAMS_LIMIT,
|
||||
});
|
||||
if (IS_BUILDING) {
|
||||
logStaticGenerationDetails(photos.length, `photo ${type}`);
|
||||
}
|
||||
|
||||
@ -527,12 +527,12 @@ export const getPhotosMeta = (options: GetPhotosOptions = {}) =>
|
||||
}));
|
||||
}, 'getPhotosMeta');
|
||||
|
||||
export const getPhotoIds = async ({ limit }: { limit?: number }) =>
|
||||
export const getPublicPhotoIds = async ({ limit }: { limit?: number }) =>
|
||||
safelyQueryPhotos(() => (limit
|
||||
? sql`SELECT id FROM photos LIMIT ${limit}`
|
||||
: sql`SELECT id FROM photos`)
|
||||
? sql`SELECT id FROM photos WHERE hidden IS NOT TRUE LIMIT ${limit}`
|
||||
: sql`SELECT id FROM photos WHERE hidden IS NOT TRUE`)
|
||||
.then(({ rows }) => rows.map(({ id }) => id as string))
|
||||
, 'getPhotoIds');
|
||||
, 'getPublicPhotoIds');
|
||||
|
||||
export const getPhoto = async (
|
||||
id: string,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user