File tree Expand file tree Collapse file tree 4 files changed +3832
-15
lines changed
Expand file tree Collapse file tree 4 files changed +3832
-15
lines changed 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 1- // eslint-disable-next-line import/no-unresolved, import/no-internal-modules
2- import { decompress } from './build/compression ' ;
1+ import { decompress } from './vendors/compression' ;
2+ import { starterTemplates } from './vendors/templates ' ;
33
44interface ProjectInfo {
55 title ?: string ;
@@ -36,8 +36,6 @@ const importProject = async (url: string): Promise<ProjectInfo> => {
3636 }
3737} ;
3838
39- const capitalize = ( word : string ) => word [ 0 ] . toUpperCase ( ) + word . slice ( 1 ) . toLowerCase ( ) ;
40-
4139export const getProjectInfo = async ( url : URL ) : Promise < ProjectInfo > => {
4240 const imports = url . searchParams . get ( 'x' ) || url . hash . slice ( 1 ) ;
4341 if ( isCompressedCode ( imports ) ) {
@@ -55,11 +53,11 @@ export const getProjectInfo = async (url: URL): Promise<ProjectInfo> => {
5553 } ;
5654 }
5755 const template = url . searchParams . get ( 'template' ) ;
58- if ( template ) {
59- const templateName = capitalize ( template ) ;
56+ const templateName = template ? starterTemplates . find ( ( t ) => t . name === template ) ?. title : '' ;
57+ if ( templateName ) {
6058 return {
61- title : templateName + ' Starter' ,
62- description : templateName + ' starter template on LiveCodes' ,
59+ title : templateName ,
60+ description : templateName + ' Template on LiveCodes' ,
6361 } ;
6462 }
6563 return {
You can’t perform that action at this time.
0 commit comments