@@ -61,13 +70,30 @@ import GalleryK from "@/components/polymech/GalleryK.astro";
Country: {howto.creatorCountry}
-
+
-
+
{index + 1}
{step.title}
-
diff --git a/src/model/component.ts b/src/model/component.ts
index d7bcdac..d67fc8e 100644
--- a/src/model/component.ts
+++ b/src/model/component.ts
@@ -63,7 +63,6 @@ export const items = (branch: string) =>{
PRODUCT_ROOT(), PFilterValid.marketplace_component), branch)
}
-
const onComponent = async (item: IStoreItem, ctx: LoaderContext) => {
/*
const onNode = async (data: INodeCallback, configuration: string) => {
diff --git a/src/model/howto.ts b/src/model/howto.ts
index cb31b9a..00905a6 100644
--- a/src/model/howto.ts
+++ b/src/model/howto.ts
@@ -6,9 +6,7 @@ import { filesEx, resolveConfig, resolve } from '@polymech/commons'
import { ICADNodeSchema, IComponentConfig } from '@polymech/commons/component'
import { RenderedContent, DataEntry } from "astro:content"
import type { Loader, LoaderContext } from 'astro/loaders'
-import { get } from '@polymech/commons/component'
-import { forward_slash } from "@polymech/commons"
-import { sanitizeFilename, validateFilename } from "@polymech/fs/utils"
+import { sanitizeFilename } from "@polymech/fs/utils"
import {
CAD_MAIN_MATCH, PRODUCT_BRANCHES,
@@ -32,18 +30,19 @@ import { IAssemblyData } from '@polymech/cad'
import { logger as log } from '@/base/index.js'
import { translate } from "@/base/i18n.js"
import { I18N_SOURCE_LANGUAGE } from "config/config.js"
+
import { slugify } from "@/base/strings.js"
import { got } from 'got'
import pMap from 'p-map'
+
import { HOWTO_MIGRATION } from '@/app/config.js'
import { createWriteStream } from 'fs';
export const ITEM_TYPE = 'howto'
//export const load = () => get(`${HOWTO_ROOT()}/${HOWTO_GLOB}`, HOWTO_ROOT(), ITEM_TYPE)
-export const item_path = (item: any) => {
- return `${HOWTO_ROOT()}/${item.data.slug}`
-}
+export const item_path = (item: any) => `${HOWTO_ROOT()}/${item.data.slug}`
+
const download = async (url, outputPath) => {
const stream = createWriteStream(outputPath);
got.stream(url).pipe(stream);
@@ -60,8 +59,6 @@ export const asset_local_abs = async (item: IHowto, asset: Image) => {
}
return false
}
-
-
export const asset_local_rel = async (item: IHowto, asset: Image) => {
const sanitizedFilename = sanitizeFilename(asset.name)
const asset_path = path.join(HOWTO_ROOT(), item.slug, sanitizedFilename)
@@ -79,7 +76,6 @@ export const howtos = async () => {
let howtos = data.v3_howtos as any[]
howtos = howtos.filter((h) => h.moderation == 'accepted');
const tags = data.v3_tags;
-
let output = {
tags: {},
howtows: {}
@@ -128,7 +124,6 @@ export const defaults = async (data: any, cwd: string, root: string) => {
return data;
};
-
const onItem = async (store: any, ctx: LoaderContext) => {
const item = store.data.item as IHowto
item.steps = item.steps || []
@@ -136,7 +131,7 @@ const onItem = async (store: any, ctx: LoaderContext) => {
step.images = await pMap(step.images, async (image) => {
return {
...image,
- src: await asset_local_rel(item, image),
+ src: await asset_local_rel(item, image) || default_image().src,
alt: image.name || ''
};
}, {
diff --git a/src/pages/[locale]/howtos/[...path].astro b/src/pages/[locale]/howtos/[...path].astro
index 7036c13..374f409 100644
--- a/src/pages/[locale]/howtos/[...path].astro
+++ b/src/pages/[locale]/howtos/[...path].astro
@@ -1,5 +1,5 @@
---
-import Layout from '@/layouts/Howto.astro'
+import Layout from '@/components/howtos/Detail.astro'
import { getCollection } from 'astro:content'
import { LANGUAGES_PROD as LANGUAGES } from "config/config.js"
diff --git a/src/pages/howtos.astro b/src/pages/howtos.astro
index 16b7b0d..8e616ed 100644
--- a/src/pages/howtos.astro
+++ b/src/pages/howtos.astro
@@ -1,7 +1,7 @@
---
import BaseLayout from "@/layouts/BaseLayout.astro"
import { getCollection } from "astro:content"
-import List from "@/components/howtos/Item.astro"
+import List from "@/components/howtos/ListItem.astro"
const all = await getCollection("howtos")
const locale = Astro.currentLocale || "en"