Skip to content

Commit

Permalink
fix: remove preview links from cms ui (#5)
Browse files Browse the repository at this point in the history
remove preview link button from cms. currently, previews are only
supported with next.js but not with astro.

closes #4
  • Loading branch information
stefanprobst authored Oct 4, 2024
2 parents 2eb1bd1 + 6e16771 commit 7d2269c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
3 changes: 1 addition & 2 deletions keystatic.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { block, mark, wrapper } from "@keystatic/core/content-components";
import { DownloadIcon, ImageIcon, LinkIcon, ListIcon } from "lucide-react";

import { Logo } from "@/components/logo";
import { createAssetPaths, createPreviewUrl } from "@/config/content.config";
import { createAssetPaths } from "@/config/content.config";
import { env } from "@/config/env.config";

function createComponents(
Expand Down Expand Up @@ -120,7 +120,6 @@ export default config({
path: "./content/pages/**",
slugField: "title",
format: { contentField: "content" },
previewUrl: createPreviewUrl("/{slug}"),
entryLayout: "content",
columns: ["title"],
schema: {
Expand Down
10 changes: 0 additions & 10 deletions src/config/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
import { env } from "@/config/env.config";

export function createAssetPaths(segment: `/${string}/`) {
return {
directory: `./public/assets${segment}`,
publicPath: `/assets${segment}`,
};
}

export function createPreviewUrl(previewUrl: string) {
if (env.PUBLIC_KEYSTATIC_MODE === "github") {
return `/api/preview/start?branch={branch}&to=${previewUrl}`;
}

return previewUrl;
}

0 comments on commit 7d2269c

Please sign in to comment.