generated from polymech/site-template
config
This commit is contained in:
parent
f6728daa6a
commit
a59625c4b1
@ -23,7 +23,7 @@
|
||||
"format": "unix-time"
|
||||
}
|
||||
],
|
||||
"default": "2025-12-27T15:01:58.480Z"
|
||||
"default": "2025-12-27T17:43:28.651Z"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -109,7 +109,7 @@
|
||||
},
|
||||
"pages": {
|
||||
"home": {
|
||||
"hero": "https://assets.osr-plastic.org/machines//assets/newsletter/common/products/extruders/overview-3.jpg",
|
||||
"hero": "https://assets.osr-plastic.org/machines/assets/newsletter/common/products/extruders/overview-3.jpg",
|
||||
"_blog": {
|
||||
"store": "resources"
|
||||
}
|
||||
@ -149,10 +149,10 @@
|
||||
"root": "${OSR_ROOT}/products",
|
||||
"howto_migration": "./data/last.json",
|
||||
"glob": "**/config.json",
|
||||
"enabled": "${OSR_ROOT}/products/config/machines.json"
|
||||
"enabled": "./library.json"
|
||||
},
|
||||
"retail": {
|
||||
"library_branch": "site-prod",
|
||||
"library_branch": "site-dev",
|
||||
"projects_branch": "projects"
|
||||
},
|
||||
"rss": {
|
||||
|
||||
@ -10,24 +10,18 @@ import getReadingTime from 'reading-time';
|
||||
import { toString } from 'mdast-util-to-string';
|
||||
import { PolymechInstance } from "@polymech/astro-base/registry";
|
||||
|
||||
import { loadConfig } from './src/app/config-loader.js';
|
||||
import { I18N_SOURCE_LANGUAGE } from "./src/app/constants.js"
|
||||
|
||||
// import domainExpansion from '@domain-expansion/astro';
|
||||
import yargs from 'yargs'
|
||||
import { hideBin } from 'yargs/helpers'
|
||||
|
||||
const argv = yargs(hideBin(process.argv)).argv;
|
||||
const config = loadConfig(I18N_SOURCE_LANGUAGE);
|
||||
|
||||
PolymechInstance.setConfig({
|
||||
//...config,
|
||||
productCategory: 'Consumer Electronics2',
|
||||
languages: ['en', 'de', 'fr', 'es', 'it'],
|
||||
products: ['laptop', 'phone', 'tablet', 'headphones', 'smartwatch', 'camera'],
|
||||
features: ['multi-language', 'dynamic-content', 'seo-optimized', 'analytics'],
|
||||
apiEndpoints: {
|
||||
products: '/api/products',
|
||||
translations: '/api/translations',
|
||||
categories: '/api/categories',
|
||||
search: '/api/search'
|
||||
},
|
||||
...config,
|
||||
callbacks: {
|
||||
onConfigUpdate: (config) => {
|
||||
//console.log('MyPages config updated:', config);
|
||||
|
||||
@ -72,7 +72,7 @@ export const DIRECTORY_EDIT_URL = (id: string, lang: string) => `${DIRECTORY_EDI
|
||||
|
||||
// Library Products
|
||||
export const PRODUCT_ROOT = () => path.resolve(resolve("${OSR_ROOT}/products"))
|
||||
export const PRODUCT_BRANCHES = read(path.join(PRODUCT_ROOT(), 'config/machines.json'), 'json')
|
||||
export const PRODUCT_BRANCHES = read('./library.json', 'json')
|
||||
export const PRODUCT_GLOB = '**/config.json'
|
||||
export const ENABLED_PRODUCTS = "${OSR_ROOT}/products/config/machines.json"
|
||||
export const PRODUCT_SPECS = (rel) => `${PRODUCT_ROOT()}/${rel}/specs.xlsx`
|
||||
|
||||
@ -4,8 +4,15 @@ import { ComponentConfigSchema } from '@polymech/commons/component'
|
||||
import { loader } from '@polymech/astro-base/model/component.js'
|
||||
import { loader as howtoLoader } from './model/howto/howto.js'
|
||||
|
||||
import { loadConfig } from './app/config-loader.js'
|
||||
import { I18N_SOURCE_LANGUAGE } from "./app/constants.js"
|
||||
|
||||
// Load config
|
||||
const config = loadConfig(I18N_SOURCE_LANGUAGE)
|
||||
const LIBARY_BRANCH = config.retail.library_branch
|
||||
|
||||
const library = defineCollection({
|
||||
loader: loader('site-dev') as any,
|
||||
loader: loader(LIBARY_BRANCH) as any,
|
||||
schema: ComponentConfigSchema.passthrough(),
|
||||
})
|
||||
|
||||
|
||||
@ -69,7 +69,6 @@ export const downloadFiles = async (dst: string, howto: IHowto) => {
|
||||
return;
|
||||
}
|
||||
if (exists(zipout)) {
|
||||
logger.debug(`already extracted: ${zipout}`)
|
||||
return
|
||||
}
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
|
||||
21
src/pages/library/[...slug].astro
Normal file
21
src/pages/library/[...slug].astro
Normal file
@ -0,0 +1,21 @@
|
||||
---
|
||||
import StoreLayout from "@/layouts/StoreLayout.astro";
|
||||
import { getCollection } from "astro:content";
|
||||
export async function getStaticPaths() {
|
||||
const store = await getCollection("library");
|
||||
const all = store.map((entry) => {
|
||||
return {
|
||||
params: {
|
||||
slug: entry.data.rel,
|
||||
},
|
||||
props: {
|
||||
page: entry,
|
||||
},
|
||||
};
|
||||
});
|
||||
return all;
|
||||
}
|
||||
const { page } = Astro.props;
|
||||
---
|
||||
|
||||
<StoreLayout frontmatter={page.data} } />
|
||||
@ -1,20 +0,0 @@
|
||||
---
|
||||
import StoreLayout from '@/layouts/StoreLayout.astro'
|
||||
import { getCollection } from 'astro:content'
|
||||
export async function getStaticPaths() {
|
||||
const store = await getCollection('store');
|
||||
const all = store.map(entry => {
|
||||
return {
|
||||
params: {
|
||||
slug:entry.data.rel
|
||||
},
|
||||
props: {
|
||||
page: entry
|
||||
}
|
||||
}
|
||||
})
|
||||
return all
|
||||
}
|
||||
const { page } = Astro.props
|
||||
---
|
||||
<StoreLayout frontmatter={page.data}}/>
|
||||
Loading…
Reference in New Issue
Block a user