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.name;
|
||||
|
||||
const baseRecipeShortName = (lang === 'en' && item.resolvedRecipe.translations?.en?.short_name)
|
||||
? item.resolvedRecipe.translations.en.short_name
|
||||
: item.resolvedRecipe.short_name;
|
||||
|
||||
result.push({
|
||||
type: 'section',
|
||||
name: item.showLabel ? (item.labelOverride || baseRecipeName) : '',
|
||||
list: combinedList,
|
||||
isReference: item.showLabel,
|
||||
short_name: item.resolvedRecipe.short_name
|
||||
short_name: baseRecipeShortName
|
||||
});
|
||||
}
|
||||
} 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.name;
|
||||
|
||||
const baseRecipeShortName = (lang === 'en' && item.resolvedRecipe.translations?.en?.short_name)
|
||||
? item.resolvedRecipe.translations.en.short_name
|
||||
: item.resolvedRecipe.short_name;
|
||||
|
||||
result.push({
|
||||
type: 'section',
|
||||
name: item.showLabel ? (item.labelOverride || baseRecipeName) : '',
|
||||
steps: combinedSteps,
|
||||
isReference: item.showLabel,
|
||||
short_name: item.resolvedRecipe.short_name
|
||||
short_name: baseRecipeShortName
|
||||
});
|
||||
}
|
||||
} else if (item.type === 'section' || !item.type) {
|
||||
|
||||
@@ -492,7 +492,7 @@ button.action_button{
|
||||
<ul style="color: var(--nord1); list-style-position: inside;">
|
||||
{#each refData.references as ref}
|
||||
<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}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user