File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { Roles } from '$lib/types/user' ;
2
- import { type WorkbookList } from '$lib/types/workbook' ;
2
+ import type { WorkBook , WorkbookList } from '$lib/types/workbook' ;
3
3
4
4
import { isAdmin } from '$lib/utils/authorship' ;
5
5
@@ -14,7 +14,7 @@ export function canViewWorkBook(role: Roles, isPublished: boolean) {
14
14
* @param workbook - The workbook object containing urlSlug and id properties
15
15
* @returns The URL slug if available, otherwise the workbook ID as a string
16
16
*/
17
- export function getUrlSlugFrom ( workbook : WorkbookList ) : string {
17
+ export function getUrlSlugFrom ( workbook : WorkbookList | WorkBook ) : string {
18
18
const slug = workbook . urlSlug ;
19
19
20
20
return slug ? slug : workbook . id . toString ( ) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,11 @@ import { INTERNAL_SERVER_ERROR } from '$lib/constants/http-response-status-codes
25
25
* <?xml version="1.0" encoding="UTF-8"?>
26
26
* <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
27
27
* <url>
28
+ * <loc>https://atcoder-novisteps.vercel.app/workbooks/2-sat</loc>
29
+ * <changefreq>daily</changefreq>
30
+ * <priority>0.8</priority>
31
+ * </url>
32
+ * <url>
28
33
* <loc>https://atcoder-novisteps.vercel.app/workbooks/123</loc>
29
34
* <changefreq>daily</changefreq>
30
35
* <priority>0.8</priority>
@@ -43,8 +48,7 @@ export const GET: RequestHandler = async () => {
43
48
publishedWorkBookIds = workbooks
44
49
. filter ( ( workbook ) => workbook . isPublished )
45
50
. map ( ( workbook ) => {
46
- // Note: To get the urlSlug, passing an empty string for authorName is sufficient
47
- return getUrlSlugFrom ( { ...workbook , authorName : '' } ) ;
51
+ return getUrlSlugFrom ( workbook ) ;
48
52
} ) ;
49
53
} catch ( e ) {
50
54
const errorMessage = e instanceof Error ? e . message : 'Unknown error' ;
You can’t perform that action at this time.
0 commit comments