polymech latest | howtos

This commit is contained in:
babayaga
2025-08-19 20:36:47 +02:00
parent dd6de61ad2
commit d9acb49f47
9 changed files with 156 additions and 67 deletions
+1
View File
@@ -38,6 +38,7 @@ const LLMConfigSchema = z.object({
defaults: z.record(z.array(z.string())).optional()
});
type LLMConfig = z.infer<typeof LLMConfigSchema>;
export const enum TemplateContext {
COMMONS = 'commons',
HOWTO = 'howto',
+1 -26
View File
@@ -78,7 +78,7 @@ const howtosByCategory = group_by_cat(allHowtoItems);
const categories = Object.keys(howtosByCategory).sort();
// Create organized page-level navigation for categories
const organizedCategories = [];
const organizedCategories: any[] = [];
// Separate and organize categories
const uncategorizedItems = howtosByCategory['Uncategorized'] || howtosByCategory['uncategorized'] || [];
@@ -149,31 +149,6 @@ organizedCategories.unshift({
const pageNavigation = organizedCategories;
// Debug: Log the sidebar structure
console.log('=== SIDEBAR DEBUG ===');
console.log('Current howto slug:', howto.slug);
console.log('Current howto category:', howto.category?.label);
console.log('Categories found:', categories);
console.log('Categorized items:', categorizedItems);
console.log('Page navigation structure:', JSON.stringify(pageNavigation, null, 2));
// Test: Simple structure to verify sidebar nesting works
const testNavigation = [
{
label: 'Test Categories',
collapsed: false,
items: [
{
label: 'Test Category 1',
collapsed: false,
items: [
{ label: 'Test Item 1', href: '/test1', isCurrent: false },
{ label: 'Test Item 2', href: '/test2', isCurrent: false }
]
}
]
}
];
// Function to extract headings from markdown content
const extractHeadingsFromMarkdown = (markdown: string): MarkdownHeading[] => {
+2 -2
View File
@@ -17,6 +17,6 @@ const content = await Astro.slots.render('default')
const translatedText = await translate(content, I18N_SOURCE_LANGUAGE, language, rest)
---
<div data-widget="polymech.i18n" class={clazz}>
<p data-widget="polymech.i18n" class={clazz}>
{translatedText}
</div>
</p>
+2 -2
View File
@@ -27,7 +27,7 @@ export const I18N_ASSET_PATH = "${SRC_DIR}/${SRC_NAME}-${DST_LANG}${SRC_EXT}"
export const HOWTO_GLOB = '**/config.json'
export const FILES_WEB = 'https://files.polymech.io/files/machines/howtos/'
export const HOWTO_EDIT_ROOT = 'https://git.polymech.io/osr-plastic/osr-machines/src/branch/master/howtos'
export const HOWTO_FILTER_LLM = true
export const HOWTO_FILTER_LLM = false
export const HOWTO_ANNOTATIONS = false
export const HOWTO_ANNOTATIONS_CACHE = false
export const HOWTO_COMPLETE_RESOURCES = false
@@ -37,7 +37,7 @@ export const HOWTO_ADD_REFERENCES = false
export const HOWTO_COMPLETE_SKILLS = false
export const HOWTO_LOCAL_RESOURCES = false
export const HOWTO_SEO_LLM = false
export const HOWTO_MAX_ITEMS = 10
export const HOWTO_MAX_ITEMS = 100
export const HOWTO_MIGRATION = () => path.resolve(resolve("./data/last.json"))
export const HOWTO_ROOT_INTERN = () => path.resolve(resolve("./public/resources/howtos"))
+3 -10
View File
@@ -20,7 +20,7 @@ const sidebarConfig = getSidebarConfig();
const categories = Object.keys(groups).sort();
// Create organized page-level navigation for categories
const organizedCategories = [];
const organizedCategories: any[] = [];
// Separate and organize categories
const uncategorizedItems = groups['Uncategorized'] || groups['uncategorized'] || [];
@@ -91,11 +91,6 @@ organizedCategories.unshift({
const pageNavigation = organizedCategories;
// Debug: Log the sidebar structure
console.log('=== INDEX SIDEBAR DEBUG ===');
console.log('Categories found:', categories);
console.log('Groups:', Object.keys(groups));
console.log('Page navigation structure:', JSON.stringify(pageNavigation, null, 2));
export async function getStaticPaths() {
return LANGUAGES.map((lang) => ({
@@ -131,7 +126,7 @@ export async function getStaticPaths() {
<Translate>How-To Guides</Translate>
</h1>
<p class="text-lg text-gray-600 mb-6">
<Translate>{items.length} guide{items.length !== 1 ? 's' : ''} available across {categories.length} categories</Translate>
<Translate>{all.length} guide{all.length !== 1 ? 's' : ''} available across {categories.length} categories</Translate>
</p>
</div>
@@ -174,9 +169,7 @@ export async function getStaticPaths() {
>
<Translate>{category}</Translate>
</h2>
<span class="text-sm text-gray-500">
{groups[category].length} <Translate>guide</Translate>{groups[category].length !== 1 ? 's' : ''}
</span>
</div>
<div class="grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">