Skip to content

Commit 4fe7dc0

Browse files
Improve see_also links
1 parent 534fd92 commit 4fe7dc0

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

web/public/_redirects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
/wiki/* /:splat
33
/Main_Page /
44

5+
/element /Element
56
/MTA_Classes /Element
67
/Element/:elementname /:elementname
78

89
/Vector/:vectorclass /:vectorclass
910

1011
/OOP /OOP_Introduction
11-
/OOP/ /OOP_Introduction

web/src/utils/general.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,36 +127,52 @@ export function getSeeAlsoLinksForItem(theItem: any): SeeAlsoLinkGroup[] {
127127
switch (itemType) {
128128
case 'function':
129129
seeAlso = shared?.see_also ?? client?.see_also ?? server?.see_also ?? [];
130-
addToSeeAlso = [`functions:any:${itemCategoryName}`, `events:any:${itemCategoryName}`];
130+
addToSeeAlso = [
131+
`functions:any:${itemCategoryName}`,
132+
`events:any:${itemCategoryName}`,
133+
`elements:any:${itemCategoryName}`,
134+
`article:Scripting_Functions`,
135+
];
131136
break;
132137
case 'event':
133138
seeAlso = see_also ?? [];
134-
addToSeeAlso = [`events:any:${itemCategoryName}`, `functions:any:${itemCategoryName}`];
139+
addToSeeAlso = [
140+
`events:any:${itemCategoryName}`,
141+
`functions:any:${itemCategoryName}`,
142+
`elements:any:${itemCategoryName}`,
143+
`article:Scripting_Events`,
144+
];
135145
break;
136146
case 'element':
137147
seeAlso = see_also ?? [];
138148
const elementCategory = getElementCategory(theItem);
139149
if (elementCategory === 'GUI') {
140150
// Show GUI functions, events and other GUI element types
151+
// as well as the Element article
141152
addToSeeAlso = [
142153
`functions:any:${elementCategory}`,
143154
`events:any:${elementCategory}`,
144155
`elements:any:${elementCategory}`,
156+
`article:Element`,
145157
];
146158
} else if (elementCategory === 'General') {
147159
// Also show generic Element functions and events if category is General
148160
addToSeeAlso = [
149161
`functions:any:${niceName}`,
150162
`events:any:${niceName}`,
163+
`elements:any:${niceName}`,
151164
`functions:any:Element`,
152165
`events:any:Element`,
166+
`article:Element`,
153167
];
154168
}
155169
else {
156170
// Show all functions and events for the element type
171+
// and the Element article
157172
addToSeeAlso = [
158173
`functions:any:${niceName}`,
159174
`events:any:${niceName}`,
175+
`article:Element`,
160176
];
161177
}
162178
break;

0 commit comments

Comments
 (0)