fix: use correct short_name for base recipe links in English and edit pages
All checks were successful
CI / update (push) Successful in 1m11s
All checks were successful
CI / update (push) Successful in 1m11s
- Use English short_name for base recipe links when viewing English recipes
- Fix edit page to use /rezepte/edit/<shortname> instead of /{data.lang}/edit/<shortname>
- Ensures base recipe reference links work correctly in both languages
This commit is contained in:
@@ -60,12 +60,16 @@ function flattenIngredientReferences(items, lang, visited = new Set()) {
|
|||||||
? item.resolvedRecipe.translations.en.name
|
? item.resolvedRecipe.translations.en.name
|
||||||
: item.resolvedRecipe.name;
|
: item.resolvedRecipe.name;
|
||||||
|
|
||||||
|
const baseRecipeShortName = (lang === 'en' && item.resolvedRecipe.translations?.en?.short_name)
|
||||||
|
? item.resolvedRecipe.translations.en.short_name
|
||||||
|
: item.resolvedRecipe.short_name;
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
type: 'section',
|
type: 'section',
|
||||||
name: item.showLabel ? (item.labelOverride || baseRecipeName) : '',
|
name: item.showLabel ? (item.labelOverride || baseRecipeName) : '',
|
||||||
list: combinedList,
|
list: combinedList,
|
||||||
isReference: item.showLabel,
|
isReference: item.showLabel,
|
||||||
short_name: item.resolvedRecipe.short_name
|
short_name: baseRecipeShortName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (item.type === 'section' || !item.type) {
|
} else if (item.type === 'section' || !item.type) {
|
||||||
|
|||||||
@@ -56,12 +56,16 @@ function flattenInstructionReferences(items, lang, visited = new Set()) {
|
|||||||
? item.resolvedRecipe.translations.en.name
|
? item.resolvedRecipe.translations.en.name
|
||||||
: item.resolvedRecipe.name;
|
: item.resolvedRecipe.name;
|
||||||
|
|
||||||
|
const baseRecipeShortName = (lang === 'en' && item.resolvedRecipe.translations?.en?.short_name)
|
||||||
|
? item.resolvedRecipe.translations.en.short_name
|
||||||
|
: item.resolvedRecipe.short_name;
|
||||||
|
|
||||||
result.push({
|
result.push({
|
||||||
type: 'section',
|
type: 'section',
|
||||||
name: item.showLabel ? (item.labelOverride || baseRecipeName) : '',
|
name: item.showLabel ? (item.labelOverride || baseRecipeName) : '',
|
||||||
steps: combinedSteps,
|
steps: combinedSteps,
|
||||||
isReference: item.showLabel,
|
isReference: item.showLabel,
|
||||||
short_name: item.resolvedRecipe.short_name
|
short_name: baseRecipeShortName
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (item.type === 'section' || !item.type) {
|
} else if (item.type === 'section' || !item.type) {
|
||||||
|
|||||||
@@ -492,7 +492,7 @@ button.action_button{
|
|||||||
<ul style="color: var(--nord1); list-style-position: inside;">
|
<ul style="color: var(--nord1); list-style-position: inside;">
|
||||||
{#each refData.references as ref}
|
{#each refData.references as ref}
|
||||||
<li>
|
<li>
|
||||||
<a href="/{data.lang}/edit/{ref.short_name}" style="color: var(--nord10); font-weight: bold; text-decoration: underline;">
|
<a href="/rezepte/edit/{ref.short_name}" style="color: var(--nord10); font-weight: bold; text-decoration: underline;">
|
||||||
{ref.name}
|
{ref.name}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user