footer | json-ld | content

This commit is contained in:
lovebird 2025-03-12 08:56:48 +01:00
parent 05ecfbf384
commit f91332c7a6
17 changed files with 2087 additions and 76 deletions

View File

@ -296,11 +296,7 @@
}
},
"resources": {
"type": "array",
"items": {
"$ref": "#/definitions/projects/properties/alternatives/items"
},
"default": []
"type": "string"
},
"tests": {
"type": "array",
@ -413,6 +409,27 @@
},
"score": {
"type": "number"
},
"body": {
"type": "string"
},
"features": {
"type": "string"
},
"highlights": {
"type": "string"
},
"specs": {
"type": "string"
},
"license": {
"type": "string"
},
"readme": {
"type": "string"
},
"shared": {
"type": "string"
}
},
"required": [

View File

@ -296,11 +296,7 @@
}
},
"resources": {
"type": "array",
"items": {
"$ref": "#/definitions/store/properties/alternatives/items"
},
"default": []
"type": "string"
},
"tests": {
"type": "array",
@ -413,6 +409,27 @@
},
"score": {
"type": "number"
},
"body": {
"type": "string"
},
"features": {
"type": "string"
},
"highlights": {
"type": "string"
},
"specs": {
"type": "string"
},
"license": {
"type": "string"
},
"readme": {
"type": "string"
},
"shared": {
"type": "string"
}
},
"required": [

File diff suppressed because one or more lines are too long

View File

@ -1,12 +1,12 @@
export default {
"environment": "dev",
"environment": "build",
"isSsrBuild": false,
"projectBase": "",
"publicDir": "C:\\Users\\zx\\Desktop\\polymech\\polymech-site\\public\\",
"rootDir": "C:\\Users\\zx\\Desktop\\polymech\\polymech-site\\",
"mode": "dev",
"outDir": "dist",
"assetsDir": "/_astro",
"mode": "production",
"outDir": "C:\\Users\\zx\\Desktop\\polymech\\polymech-site\\dist\\",
"assetsDir": "_astro",
"sourcemap": false,
"assetFileNames": "/_astro/[name]@[width].[hash][extname]"
}

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,8 @@
"image": {
"default": "/images/default-image.png",
"error": "/images/error-image.png",
"alt": "Astrofront"
"alt": "Astrofront",
"src": "https://assets.osr-plastic.org/machines//assets/newsletter/common/products/extruders/overview-3.jpg"
}
},
"footer_left": [
@ -25,7 +26,11 @@
{
"href": "/infopages/contact",
"text": "Contact"
}
} ,
{
"href": "/newsletter/newsletter_2024_09_en-hugo-release.html",
"text": "Newsletter"
}
],
"footer_right": [

View File

@ -20,25 +20,22 @@ export const items = async (opts: { locale: string }) => {
}
]
}
export const footer_left = async ( locale: string ) => {
const _T = async (text: string) => await translate(text, I18N_SOURCE_LANGUAGE, locale)
return await pMap(config.footer_left, async (item) => {
const isAbsoluteUrl = (url: string): boolean => /^[a-zA-Z]+:/.test(url);
const createFooterLinks = async (items: any[], locale: string) => {
const _T = async (text: string) => await translate(text, I18N_SOURCE_LANGUAGE, locale);
return await pMap(items, async (item) => {
const translatedText = await _T(item.text); // Single translation call
return {
"href": `/${locale}${item.href}`,
"title": await _T(item.text),
"ariaLabel": item.text,
"href": isAbsoluteUrl(item.href) ? item.href : `/${locale}${item.href}`,
"title": translatedText, // Use cached translation
"ariaLabel": translatedText, // Use cached translation
"class": "hover:text-orange-600"
}
};
});
}
export const footer_right = async ( locale: string ) => {
const _T = async (text: string) => await translate(text, I18N_SOURCE_LANGUAGE, locale)
return await pMap(config.footer_right, async (item) => {
return {
"href": `/${item.href}`,
"title": await _T(item.text),
"ariaLabel": item.text,
"class": "hover:text-orange-600"
}
});
}
};
export const footer_left = (locale: string) => createFooterLinks(config.footer_left, locale);
export const footer_right = (locale: string) => createFooterLinks(config.footer_right, locale);

View File

@ -16,10 +16,6 @@ import StructuredData from './head/ArticleStructuredData.astro'
import Hreflang from '@/components/polymech/hreflang.astro'
import { IComponentConfig } from "@polymech/commons"
// Determine the path to your compiled Tailwind CSS.
// Assuming your built Tailwind CSS ends up in 'global.css' in your public directory after Astro build.
const tailwindCSSPath = "/global.css"; // <- **Important: Verify this path after your build process**
export interface Props {
title?: string;
meta_title?: string;
@ -51,7 +47,7 @@ const hreflangs = LANGUAGES_PROD.filter((lang)=>lang!==Astro.currentLocale).map(
}))
const image = item?.image || config.site.image
const image_url = image.url
const image_url = image.src
const image_alt = image.alt
const title = item?.title as string || config.site.title || ""

View File

@ -74,11 +74,11 @@ const filteredGroups: Record<
return acc;
}, {});
const extraContent = [data.extra_resources, data.tests]
const extraContent = [data.resources, data.tests]
.filter((s) => s && s.length)
.map(createMarkdownComponent)
const sharedContent = [data.shared_resources]
const sharedContent = [data.shared]
.filter((s) => s && s.length)
.map(createMarkdownComponent)
---

View File

@ -2,7 +2,7 @@
import BaseHead from "../components/BaseHead.astro";
import Navigation from "../components/global/Navigation.astro";
import Footer from "../components/global/Footer.astro";
import { I18N_SOURCE_LANGUAGE, isRTL } from "config/config.js"
import { isRTL } from "config/config.js"
const { frontmatter: frontmatter, additionalKeywords, ...rest } = Astro.props;

View File

@ -43,8 +43,9 @@ import {
} from "config/config.js";
const { frontmatter: item, ...rest } = Astro.props;
const content = await translate(
item.content || "",
item.body || "",
I18N_SOURCE_LANGUAGE,
Astro.currentLocale,
);

View File

@ -184,22 +184,10 @@ const onItem = async (item: IStoreItem, ctx: ILoaderContextEx) => {
renderings: [],
gallery: []
}
//////////////////////////////////////////
//
// Body
//
let contentPath = path.join(itemDir, 'templates/shared', 'body.md')
await getRenderFunction(contentPath)
if (exists(contentPath)) {
data.content = read(contentPath) as string
item.filePath = contentPath
}
//////////////////////////////////////////
//
// Item Extra Resources
//
let resourcesPath = path.join(itemDir, 'templates/shared', 'resources.md')
exists(resourcesPath) && (data.extra_resources = read(resourcesPath) as string || "")
data.body = (read(path.join(itemDir, 'templates/shared', 'body.md')) as string) || ""
data.resources = (read(path.join(itemDir, 'templates/shared', 'resources.md')) as string) || ""
//////////////////////////////////////////
//
// Item Shared Resources
@ -208,15 +196,13 @@ const onItem = async (item: IStoreItem, ctx: ILoaderContextEx) => {
stopAt: PRODUCT_ROOT(),
cwd: itemDir
}) || ""
exists(resourcesDefaultPath) && (data.shared_resources = read(resourcesDefaultPath) as string || "")
data.shared = (read(resourcesDefaultPath) as string) || ""
//////////////////////////////////////////
//
// Readme
//
let readmePath = path.join(itemDir, 'Readme.md')
if (exists(readmePath)) {
data.readme = read(readmePath) as string
}
data.readme = (read(readmePath) as string) || ""
//////////////////////////////////////////
//
// Variables
@ -252,16 +238,14 @@ const onItem = async (item: IStoreItem, ctx: ILoaderContextEx) => {
data.assets.renderings = await gallery('renderings', data.rel) as []
data.assets.renderings.length && (data.thumbnail =
{
alt: '',
url: data.assets.renderings[0].thumb,
src: data.assets.renderings[0].thumb
alt: data.assets.renderings[0].alt,
url: data.assets.renderings[0].url,
src: data.assets.renderings[0].url
})
data.assets.gallery = await gallery('media/gallery', data.rel) as []
data.image = data.assets.renderings[0] || {}
data.assets.showcase = await gallery('media/showcase', data.rel) as []
data.assets.samples = await gallery('media/samples', data.rel) as []
}
export function loader(branch: string): Loader {
@ -281,12 +265,13 @@ export function loader(branch: string): Loader {
const id = product.slug;
const data = {
rel: item.rel,
title: product.name,
slug: id,
id,
title: product.name,
type: 'product',
highlights: [],
components: [],
...product
...product,
}
//const parsedData = await parseData({ id, data: data });
const storeItem = {
@ -304,9 +289,11 @@ export function loader(branch: string): Loader {
generateDigest,
entryTypes
} as any)
storeItem.data['config'] = JSON.stringify({
...storeItem.data
}, null, 2)
store.set(storeItem)
}
}

View File

@ -59,11 +59,15 @@ export const get = async (node: IComponentNode, component: IComponentConfig, opt
url?: string
}): Promise<ProductJsonLD> => {
if(!component.price || !component.body){
return {} as any
}
const jsonLD: ProductJsonLD = {
'@context': 'https://schema.org',
'@type': 'Product',
name: component.name,
description: component.keywords,
description: component.body || component.keywords,
sku: component.code,
brand: {
'@type': 'Brand',

View File

@ -3,6 +3,7 @@ import BaseLayout from "@/layouts/BaseLayout.astro";
import Wrapper from "@/components/containers/Wrapper.astro";
import { LANGUAGES_PROD } from "config/config.js";
import config from "config/config.json";
import { getCollection } from "astro:content";
import StoreEntries from "@/components/store/StoreEntries.astro";
import CtaOne from "@/components/cta/CtaOne.astro";
@ -26,9 +27,19 @@ export function getStaticPaths() {
return all;
}
const groups = await group_by_path(items, locale);
const frontmatter = {
title: "Store",
description: "Store",
keywords: "Store",
image:{
src: config.pages.home.hero,
url: config.pages.home.hero,
alt: config.metadata.keywords
}
};
---
<BaseLayout>
<BaseLayout frontmatter={frontmatter}>
<Wrapper variant="standard" class="py-4">
<CtaOne />
<section>

View File

@ -30,6 +30,14 @@ const locale = Astro.currentLocale || "en"
}
</div>
</section>
{ <script>
const currentPath = window.location.pathname;
if (!/^\/[a-z]{2}(\/|$)/i.test(currentPath)) {
let language = navigator.language
language = language.split('-')[0]
language = "en"
window.location.href = `/${language}`;
}
</script>
</BaseLayout>

View File

@ -0,0 +1 @@
TEST,TEST
1 TEST TEST

View File

@ -0,0 +1,10 @@
{
"glossaryId": "94f02b66-2ee8-4119-a8d7-e0a11dd8992d",
"name": "OSR-en-pt",
"ready": true,
"sourceLang": "en",
"targetLang": "pt",
"creationTime": "2025-03-11T22:17:00.006Z",
"entryCount": 1,
"hash": "zDrlayXO43sB98wNoqof0g=="
}