Commit 2a9b747 1 parent 25ff55d commit 2a9b747 Copy full SHA for 2a9b747
File tree 1 file changed +20
-0
lines changed
src/app/learn/[type]/[id]/[chapter_id]
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,26 @@ import { Steper } from './Steper';
20
20
import { Content } from './Content' ;
21
21
import { PostTime } from './PostTime' ;
22
22
23
+ export async function generateMetadata ( { params } ) {
24
+ const { data } = await get ( `v1/learn/course/${ params . type === 'courses' ? 'opencourse' : 'challenges' } /${ params . id } ` , { isServer : true } ) ;
25
+ const previousImages = `https://file-cdn.openbuild.xyz${ data ?. base ?. course_series_img } ` || '' ;
26
+ return {
27
+ title : data ?. base ?. course_series_title ,
28
+ description : data ?. base ?. course_series_summary ,
29
+ openGraph : {
30
+ title : data ?. base ?. course_series_title ,
31
+ description : data ?. base ?. course_series_summary ,
32
+ images : [ previousImages ] ,
33
+ } ,
34
+ twitter : {
35
+ card : 'summary_large_image' ,
36
+ title : data ?. base ?. course_series_title ,
37
+ description : data ?. base ?. course_series_summary ,
38
+ images : [ previousImages ] ,
39
+ } ,
40
+ } ;
41
+ }
42
+
23
43
export default async function ChapterPage ( { params } ) {
24
44
const datas = await Promise . all ( [
25
45
get ( `v1/learn/course/${ params . type === 'courses' ? 'opencourse' : 'challenges' } /${ params . id } ` , { isServer : true } ) ,
You can’t perform that action at this time.
0 commit comments