|
| 1 | +const moment = require('moment'); |
| 2 | +const raw = require('config/raw').raw; |
| 3 | + |
| 4 | +// ***Copy this file to `config/local.js` and change the copy to fit your site and needs.*** |
| 5 | + |
| 6 | +// Override the implementation of this function to fit your needs. |
| 7 | +// See `posts.generators.filename` below for more details. |
| 8 | +const generatePostFilename = (timestamp, slug) => { |
| 9 | + const suffix = slug ? `_${slug}` : ''; |
| 10 | + const postDate = moment(timestamp).format('YYYY/MM/DD_HH.mm.ss'); |
| 11 | + return `${postDate}${suffix}.md`; |
| 12 | +}; |
| 13 | + |
| 14 | +// Override the implementation of this function to fit your needs. |
| 15 | +// See `posts.generators.url` below for more details. |
| 16 | +const generatePostUrl = (timestamp, slug) => { |
| 17 | + const filename = generatePostFilename(timestamp, slug); |
| 18 | + return `https://example.com/microblog/${filename.replace(/\.md$/, '.html')}`; |
| 19 | +}; |
| 20 | + |
| 21 | +// Override the implementation of this function to fit your needs. |
| 22 | +// see `media.generators.filenamePrefix` below for more details. |
| 23 | +const generateMediaFilenamePrefix = (timestamp, slug) => { |
| 24 | + return 'static/'; |
| 25 | +}; |
| 26 | + |
| 27 | +// Override the implementation of this function to fit your needs. |
| 28 | +// see `media.generators.filenameSuffix` below for more details. |
| 29 | +const generateMediaFilenameSuffix = () => { |
| 30 | + return 'microblog_assets/:year/:month/:slug_:filesslug'; |
| 31 | +}; |
| 32 | + |
| 33 | +module.exports = { |
| 34 | + app: { |
| 35 | + //Which local TCP port the server should listen on. |
| 36 | + listenPort: 8080, |
| 37 | + |
| 38 | + // URL of an RSS/Atom/JSON feed that will contain Microblog posts after `app.publishCommand` runs. |
| 39 | + // If set, will ping [micro.blog](https://micro.blog) with that feed, informing micro.blog to check for new posts. |
| 40 | + // If you don't use https://micro.blog, leave this value empty. |
| 41 | + microblogPingFeedURL: '', |
| 42 | + |
| 43 | + // Local path to a script that will consume written Microblog posts |
| 44 | + // (Markdown files) and media files written to `app.siteRoot` (below) and publish them to the Internet, |
| 45 | + // commit changes to your site to Git, etc. |
| 46 | + publishCommand: '/path/to/a/script', |
| 47 | + }, |
| 48 | + site: { |
| 49 | + indieauth: { |
| 50 | + // Your IndieAuth-enabled website; will be used as the IndieAuth identity. |
| 51 | + identity: 'https://example.com', |
| 52 | + |
| 53 | + // IndieAuth token endpoint. |
| 54 | + // If your website includes a `<link rel="token_endpoint">` tag, duplicate its value here. |
| 55 | + tokenEndpoint: 'https://tokens.indieauth.com/token', |
| 56 | + }, |
| 57 | + |
| 58 | + // Local path to the source of your statically-generated site. |
| 59 | + // All local paths configured in the `posts` and `media` sections below will be treated as relative to this path. |
| 60 | + root: '/path/to/your/site', |
| 61 | + }, |
| 62 | + posts: { |
| 63 | + generators: { |
| 64 | + // Function that generates post URLs that correspond to where |
| 65 | + // posts will appear on your site after `app.publishCommand` runs. |
| 66 | + url: raw(generatePostUrl), |
| 67 | + |
| 68 | + // Function that generates a unique filename for each post, relative to `site.root`. |
| 69 | + // Directories should be separated by forward slashes |
| 70 | + // and will be automatically created if they don't exist in the fileystem. |
| 71 | + filename: raw(generatePostFilename), |
| 72 | + }, |
| 73 | + |
| 74 | + // If nonempty, will include the configured Jekyll-style layout name in each post. |
| 75 | + layoutName: '', |
| 76 | + |
| 77 | + tags: { |
| 78 | + // The key that tag values will be assigned to in the generated front matter of each post. |
| 79 | + key: 'tags', |
| 80 | + |
| 81 | + // Controls the format of the tags list in the generated front matter of each post. |
| 82 | + // Valid values are `space_delimited` (Jekyll style) or `yaml_list` (Hugo style). |
| 83 | + style: 'space_delimited', |
| 84 | + }, |
| 85 | + }, |
| 86 | + media: { |
| 87 | + // Note: Media files will be written to disk at a location which is the |
| 88 | + // combination of `media.generators.filenamePrefix` and `media.generators.filenameSuffix`, in that order. |
| 89 | + // Directories in generated outputs should be separated by forward slashes, |
| 90 | + // and will be automatically created if they don't exist in the fileystem. |
| 91 | + generators: { |
| 92 | + // Function that generates a path relative to `site.root`, |
| 93 | + // which will have `filenameSuffix` appended when media files are written to disk. |
| 94 | + // Can return empty string ('') if you want the location of files on disk |
| 95 | + // to exactly match the filenames in the front matter of generated posts. |
| 96 | + filenamePrefix: raw(generateMediaFilenamePrefix), |
| 97 | + |
| 98 | + // Function that generates a unique filename for each media file, relative to `media.generators.filenamePrefix`. |
| 99 | + // Can contain any tokens used in Jekyll permalinks, even if you don't use Jekyll: https://jekyllrb.com/docs/permalinks/ |
| 100 | + // Generated output should not contain a file extension, but rather, should always contain the string `:filesslug`. |
| 101 | + filenameSuffix: raw(generateMediaFilenameSuffix), |
| 102 | + }, |
| 103 | + }, |
| 104 | +}; |
0 commit comments