fix deploy index
This commit is contained in:
@@ -36,8 +36,6 @@ export const deploy = {
|
||||
)
|
||||
);
|
||||
|
||||
g.deploy.index = prodIndex(this.config.site_id);
|
||||
|
||||
if (g.deploy.gz) {
|
||||
for (const page of g.deploy.gz.layouts) {
|
||||
if (page.is_default_layout) {
|
||||
@@ -133,7 +131,6 @@ export const deploy = {
|
||||
raw: null,
|
||||
gz: null,
|
||||
server: null,
|
||||
index: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -101,6 +101,5 @@ export const g = global as unknown as {
|
||||
deploy: { ts: string };
|
||||
};
|
||||
server: PrasiServer | null;
|
||||
index: ReturnType<typeof prodIndex> | null;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
export const prodIndex = (site_id: string) => {
|
||||
export const prodIndex = (
|
||||
site_id: string,
|
||||
prasi: { page_id?: string; params?: any }
|
||||
) => {
|
||||
return {
|
||||
head: [] as string[],
|
||||
body: [] as string[],
|
||||
@@ -19,7 +22,16 @@ export const prodIndex = (site_id: string) => {
|
||||
${this.body.join("\n")}
|
||||
<div id="root"></div>
|
||||
<script>
|
||||
window._prasi = { basepath: "/", site_id: "${site_id}" }
|
||||
window._prasi = {
|
||||
basepath: "/prod/${site_id}",
|
||||
site_id: "${site_id}",${
|
||||
prasi.page_id ? `\n page_id: "${prasi.page_id}",` : ""
|
||||
}${
|
||||
typeof prasi.params === "object"
|
||||
? `\n params: ${JSON.stringify(prasi.params)},`
|
||||
: ""
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="/main.js" type="module"></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user