-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Externalize prepare template * Update doc * Add route example * Add lang in template
- Loading branch information
Willy Brauner
authored
Dec 15, 2022
1 parent
1f1ee4b
commit ad0d7a6
Showing
10 changed files
with
81 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Replace strings | ||
* @param layout | ||
* @param meta | ||
* @param app | ||
* @param ssrStaticProps | ||
* @param globalData | ||
* @param lang | ||
* @return {string} | ||
*/ | ||
export const prepareTemplate = ( | ||
layout, | ||
{ meta, app, ssrStaticProps, globalData, lang } | ||
) => { | ||
if (!layout) return "" | ||
return layout | ||
.replaceAll(`<!--meta-title-->`, meta?.title ?? "") | ||
.replaceAll(`<!--meta-description-->`, meta?.description ?? "") | ||
.replaceAll(`<!--meta-imageUrl-->`, meta?.imageUrl ?? "") | ||
.replaceAll(`<!--meta-url-->`, meta?.url ?? "") | ||
.replaceAll(`<!--meta-siteName-->`, meta?.siteName ?? "") | ||
.replace(`<!--lang-->`, lang) | ||
.replace(`<!--app-html-->`, app) | ||
.replace(`"<!--ssr-static-props-->"`, JSON.stringify(ssrStaticProps)) | ||
.replace(`"<!--ssr-global-data-->"`, JSON.stringify(globalData)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters