Set open graph for demo (#3267)
This commit is contained in:
parent
c7eb4f0622
commit
300b57ace0
3 changed files with 33 additions and 2 deletions
BIN
assets/og.png
Normal file
BIN
assets/og.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
|
@ -7,7 +7,12 @@
|
||||||
content="width=device-width, initial-scale=1.0, user-scalable=no"
|
content="width=device-width, initial-scale=1.0, user-scalable=no"
|
||||||
/>
|
/>
|
||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
<title>Saleor e-commerce</title>
|
<title>Sign in to the Saleor Dashboard</title>
|
||||||
|
|
||||||
|
<meta name="description" content="Sign in to the Saleor Dashboard to manage your orders, payments, products and more.">
|
||||||
|
|
||||||
|
<%- injectOgTags %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
window.__SALEOR_CONFIG__ = {
|
window.__SALEOR_CONFIG__ = {
|
||||||
API_URL: "<%= API_URL %>",
|
API_URL: "<%= API_URL %>",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
|
import { NodeGlobalsPolyfillPlugin } from "@esbuild-plugins/node-globals-polyfill";
|
||||||
|
import { copyFileSync } from "fs";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import nodePolyfills from "rollup-plugin-polyfill-node";
|
import nodePolyfills from "rollup-plugin-polyfill-node";
|
||||||
import { defineConfig, loadEnv } from "vite";
|
import { defineConfig, loadEnv } from "vite";
|
||||||
|
@ -8,6 +9,14 @@ import { VitePWA } from "vite-plugin-pwa";
|
||||||
import viteSentry from "vite-plugin-sentry";
|
import viteSentry from "vite-plugin-sentry";
|
||||||
import { swcReactRefresh } from "vite-plugin-swc-react-refresh";
|
import { swcReactRefresh } from "vite-plugin-swc-react-refresh";
|
||||||
|
|
||||||
|
const copyOgImage = () => ({
|
||||||
|
name: "copy-og-image",
|
||||||
|
apply: "build",
|
||||||
|
writeBundle: () => {
|
||||||
|
copyFileSync("./assets/og.png", "./build/dashboard/og.png");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
export default defineConfig(({ command, mode }) => {
|
export default defineConfig(({ command, mode }) => {
|
||||||
const isDev = command !== "build";
|
const isDev = command !== "build";
|
||||||
const env = loadEnv(mode, process.cwd(), "");
|
const env = loadEnv(mode, process.cwd(), "");
|
||||||
|
@ -42,6 +51,7 @@ export default defineConfig(({ command, mode }) => {
|
||||||
FLAGSMITH_ID,
|
FLAGSMITH_ID,
|
||||||
} = env;
|
} = env;
|
||||||
|
|
||||||
|
const base = STATIC_URL ?? "/";
|
||||||
const featureFlagsEnvs = Object.fromEntries(
|
const featureFlagsEnvs = Object.fromEntries(
|
||||||
Object.entries(env).filter(([flagKey]) => flagKey.startsWith("FF_")),
|
Object.entries(env).filter(([flagKey]) => flagKey.startsWith("FF_")),
|
||||||
);
|
);
|
||||||
|
@ -67,9 +77,25 @@ export default defineConfig(({ command, mode }) => {
|
||||||
APPS_MARKETPLACE_API_URI,
|
APPS_MARKETPLACE_API_URI,
|
||||||
APPS_TUNNEL_URL_KEYWORDS,
|
APPS_TUNNEL_URL_KEYWORDS,
|
||||||
IS_CLOUD_INSTANCE,
|
IS_CLOUD_INSTANCE,
|
||||||
|
injectOgTags:
|
||||||
|
DEMO_MODE &&
|
||||||
|
`
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
<meta property="og:title" content="Sign in to the Saleor Dashboard">
|
||||||
|
<meta property="og:description" content="Sign in to the Saleor Dashboard to manage your orders, payments, products and more.">
|
||||||
|
<meta property="og:image" content="${base}og.png">
|
||||||
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
|
<meta name="twitter:title" content="Sign in to the Saleor Dashboard">
|
||||||
|
<meta name="twitter:description" content="Sign in to the Saleor Dashboard to manage your orders, payments, products and more.">
|
||||||
|
<meta name="twitter:image" content="${base}og.png">
|
||||||
|
<meta property="og:url" content="https://demo.saleor.io/dashboard/">
|
||||||
|
<meta property="twitter:domain" content="demo.saleor.io">
|
||||||
|
<meta property="twitter:url" content="https://demo.saleor.io/dashboard/">
|
||||||
|
`,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
copyOgImage(),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (enableSentry) {
|
if (enableSentry) {
|
||||||
|
@ -120,7 +146,7 @@ export default defineConfig(({ command, mode }) => {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
root: "src",
|
root: "src",
|
||||||
base: STATIC_URL ?? "/",
|
base,
|
||||||
envDir: "..",
|
envDir: "..",
|
||||||
server: {
|
server: {
|
||||||
port: 9000,
|
port: 9000,
|
||||||
|
|
Loading…
Reference in a new issue