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 11import { Roles } from '$lib/types/user' ;
2- import { type WorkbookList } from '$lib/types/workbook' ;
2+ import type { WorkBook , WorkbookList } from '$lib/types/workbook' ;
33
44import { isAdmin } from '$lib/utils/authorship' ;
55
@@ -14,7 +14,7 @@ export function canViewWorkBook(role: Roles, isPublished: boolean) {
1414 * @param workbook - The workbook object containing urlSlug and id properties
1515 * @returns The URL slug if available, otherwise the workbook ID as a string
1616 */
17- export function getUrlSlugFrom ( workbook : WorkbookList ) : string {
17+ export function getUrlSlugFrom ( workbook : WorkbookList | WorkBook ) : string {
1818 const slug = workbook . urlSlug ;
1919
2020 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
2525 * <?xml version="1.0" encoding="UTF-8"?>
2626 * <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2727 * <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>
2833 * <loc>https://atcoder-novisteps.vercel.app/workbooks/123</loc>
2934 * <changefreq>daily</changefreq>
3035 * <priority>0.8</priority>
@@ -43,8 +48,7 @@ export const GET: RequestHandler = async () => {
4348 publishedWorkBookIds = workbooks
4449 . filter ( ( workbook ) => workbook . isPublished )
4550 . 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 ) ;
4852 } ) ;
4953 } catch ( e ) {
5054 const errorMessage = e instanceof Error ? e . message : 'Unknown error' ;
You can’t perform that action at this time.
0 commit comments