This file contains hidden or 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
| <div itemscope itemtype ="http://schema.org/Movie"> | |
| <h1 itemprop="name">Avatar</h1> | |
| <span>Director: <span itemprop="director">James Cameron</span> (born August 16, 1954)</span> | |
| <span itemprop="genre">Science fiction</span> | |
| <a href="../movies/avatar-theatrical-trailer.html" itemprop="trailer">Trailer</a> | |
| </div> |
This file contains hidden or 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
| const GetPathsFromBuildFolder = (dir: string, urlList: Array<Url>, host: string, basePath: string): Array<Url> => { | |
| const files: string[] = fs.readdirSync(dir); | |
| urlList = urlList || []; | |
| files.forEach((file) => { | |
| if (fs.statSync(dir + file).isDirectory()) { | |
| urlList = GetPathsFromBuildFolder(dir + file + '/', urlList, host, basePath); | |
| } else { | |
| if (path.extname(file) == '.json') { | |
| let route = path.join(dir + file.substring(0, file.length - 5)); |
This file contains hidden or 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
| const GetPathsFromManifest = (manifest: any, basePath: string, host: string): Array<Url> => { | |
| let routes: Array<string> = []; | |
| for (let [route, file] of Object.entries(manifest)) { | |
| if (!isNextInternalUrl(route)) { | |
| // Add static paths | |
| routes = routes.concat(route); | |
| } else if (isDynamicUrl(route)) { | |
| // Add dynamic paths | |
| const dynamicRoute: DynamicRoute = GetBuildPath(route, basePath); |
This file contains hidden or 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
| module.exports = { | |
| webpack: (config, { isServer }) => { | |
| // Fixes npm packages that depend on `fs` module | |
| if (!isServer) { | |
| config.node = { | |
| fs: 'empty' | |
| } | |
| } | |
| return config |
This file contains hidden or 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
| const isNextInternalUrl = (path: string): boolean => { | |
| return new RegExp(/[^\/]*^.[_]|(?:\[)/g).test(path); | |
| } |
This file contains hidden or 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
| const GetPathsFromManifest = (manifest: any, basePath: string, host: string): Array<Url> => { | |
| let routes: Array<string> = []; | |
| for (let [route, file] of Object.entries(manifest)) { | |
| if (!isNextInternalUrl(route)) { | |
| // Add static paths | |
| routes = routes.concat(route); | |
| } | |
| } |
This file contains hidden or 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
| const ReadManifestFile = (basePath: string): object => { | |
| const routes_manifest_path = path.join(basePath + '/.next/server/pages-manifest.json'); | |
| // Read from the file | |
| if (fs.existsSync(routes_manifest_path)) { | |
| const raw_json = fs.readFileSync(routes_manifest_path); | |
| return JSON.parse(raw_json.toString()); | |
| } else return null; | |
| }; |
This file contains hidden or 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
| import { GetServerSideProps } from 'next'; | |
| import fs from 'fs'; | |
| import path from 'path'; | |
| export default function Sitemap() {} | |
| type Url = { | |
| host: string; | |
| route: string; | |
| date?: Date; |
This file contains hidden or 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
| ``` | |
| . | |
| ├── _config.yml | |
| ├── _data | |
| │ └── members.yml | |
| ├── _drafts | |
| │ ├── begin-with-the-crazy-ideas.md | |
| │ └── on-simplicity-in-technology.md | |
| ├── _includes | |
| │ ├── footer.html |