0.0.47 • Published 2 years ago
@elwood-studio/distribute-nextjs v0.0.47
Elwood Studio / Distribute / Next.js
Use Elwood Studio Distribute in your Next.js app
Documentation
Find full documentation at elwood.studio/docs/distribute/nextjs.
Quick Start
Usage
Take a look in examples for more information on how to use this library.
1. Update your next.config.js
# next.config.js
const { join } = require('path');
const { withElwoodStudioDistribute } = require('@elwood-studio/distribute-nextjs');
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
};
module.exports = withElwoodStudioDistribute(nextConfig, {
dataDir: join(__dirname, './data'),
});
2. Add (or update) the custom server.js
# server.js
require('@elwood-studio/distribute-nextjs/server')({
dir: __dirname,
});
3. Pick a template
# template.js
const { createTemplate} = require('@elwood-studio/distribute-react/template/podcast');
module.exports = createTemplate({})
4. Update your App
# pages/_app.ts
const { withTemplateApp } = require('@elwood-studio/distribute-nextjs');
const template = require('../template');
module.exports = withTemplateApp(template);
5. Add the fallback page
# pages/[[...slug]].jsx
const { withTemplatePage } = require('@elwood-studio/distribute-nextjs');
const template = require('../template');
const t = withTemplatePage(template);
export default t.default;
export const getStaticPaths = t.getStaticPaths;
export const getStaticProps = t.getStaticProps;
License
Distributed under the Apache-2.0 license. See LICENSE for more information.
Contact
Elwood Studio - @hello_elwood - support@elwood.studio