File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -58,10 +58,10 @@ export const onRequest: PgFunction = async function (context) {
5858 } "`,
5959 )
6060 . replace (
61- / c o n t e n t = " C o d e P l a y g r o u n d T h a t J u s t W o r k s ! " / g,
61+ / c o n t e n t = " A C o d e P l a y g r o u n d T h a t J u s t W o r k s ! " / g,
6262 `content="${
6363 ! title && ! description
64- ? 'Code Playground That Just Works!'
64+ ? 'A Code Playground That Just Works!'
6565 : description || 'A project on LiveCodes.'
6666 } "`,
6767 )
Original file line number Diff line number Diff line change 11import { decompress } from './vendors/compression' ;
2+ import { starterTemplates } from './vendors/templates' ;
23
34interface ProjectInfo {
45 title ?: string ;
@@ -35,8 +36,6 @@ const importProject = async (url: string): Promise<ProjectInfo> => {
3536 }
3637} ;
3738
38- const capitalize = ( word : string ) => word [ 0 ] . toUpperCase ( ) + word . slice ( 1 ) . toLowerCase ( ) ;
39-
4039export const getProjectInfo = async ( url : URL ) : Promise < ProjectInfo > => {
4140 const imports = url . searchParams . get ( 'x' ) || url . hash . slice ( 1 ) ;
4241 if ( isCompressedCode ( imports ) ) {
@@ -54,11 +53,11 @@ export const getProjectInfo = async (url: URL): Promise<ProjectInfo> => {
5453 } ;
5554 }
5655 const template = url . searchParams . get ( 'template' ) ;
57- if ( template ) {
58- const templateName = capitalize ( template ) ;
56+ const templateName = template ? starterTemplates . find ( ( t ) => t . name === template ) ?. title : '' ;
57+ if ( templateName ) {
5958 return {
60- title : templateName + ' Starter' ,
61- description : templateName + ' starter template on LiveCodes' ,
59+ title : templateName ,
60+ description : templateName + ' Template on LiveCodes' ,
6261 } ;
6362 }
6463 return {
You can’t perform that action at this time.
0 commit comments