index page updated to static export
This commit is contained in:
1 parent
4de352e2df
commit
3103f3689b
2 files changed
+24
-22
No files matched your search
+2
-2
@@ -17,7 +17,7 @@ function createPath(page, map, query, items) {
|
||||
module.exports = withCss(withSass({
|
||||
exportTrailingSlash: true,
|
||||
env: {
|
||||
ARTICLES_PAGE_SIZE: 15,
|
||||
APP_ARTICLES_PAGE_SIZE: 15,
|
||||
},
|
||||
webpack(config) {
|
||||
config.resolve.modules.push(__dirname)
|
||||
@@ -33,7 +33,7 @@ module.exports = withCss(withSass({
|
||||
|
||||
return {
|
||||
// ...defaultPathMap,
|
||||
'/': { page: '/', query: { pageSize: articlesPageSize } },
|
||||
'/': { page: '/' },
|
||||
'/documents': { page: '/documents' },
|
||||
'/gallery': { page: '/gallery' },
|
||||
'/collective': { page: '/collective' },
|
||||
|
||||
+22
-20
@@ -1,13 +1,13 @@
|
||||
import React from 'react'
|
||||
import Head from 'next/head'
|
||||
import { App } from '../src/components/App'
|
||||
import { Meta } from '../src/components/Meta'
|
||||
import { ArticleCardList } from '../src/components/ArticleCardList'
|
||||
import { HudozkaTitle } from '../src/components/HudozkaTitle'
|
||||
import menuModel from '../src/models/menu'
|
||||
import { meta } from '../src/lib/meta'
|
||||
import { buildMenu } from '../src/lib/menu'
|
||||
import { createApiUrl, requestGet, wrapInitialProps } from '../src/next-lib'
|
||||
import { App } from 'src/components/App'
|
||||
import { Meta } from 'src/components/Meta'
|
||||
import { ArticleCardList } from 'src/components/ArticleCardList'
|
||||
import { HudozkaTitle } from 'src/components/HudozkaTitle'
|
||||
import menuModel from 'src/models/menu'
|
||||
import { meta } from 'src/lib/meta'
|
||||
import { buildMenu } from 'src/lib/menu'
|
||||
import { createApiUrl, requestGet } from 'src/next-lib'
|
||||
import { NextPage } from 'next'
|
||||
|
||||
interface IProps {
|
||||
@@ -41,10 +41,10 @@ const Page: NextPage<IProps> = props => (
|
||||
</App>
|
||||
)
|
||||
|
||||
Page.getInitialProps = wrapInitialProps(async (ctx) => {
|
||||
export const unstable_getStaticProps = async () => {
|
||||
const pageUrl = '/'
|
||||
const page = 1
|
||||
const pageSize = ctx.query.pageSize || 15
|
||||
const pageSize = process.env.APP_ARTICLES_PAGE_SIZE
|
||||
const res = await requestGet(createApiUrl(`/api/articles?page=${page}&pageSize=${pageSize}`), {}) as any
|
||||
const articles = res.items || []
|
||||
const nextPage = res.nextPage
|
||||
@@ -52,16 +52,18 @@ Page.getInitialProps = wrapInitialProps(async (ctx) => {
|
||||
const title = 'Шлиссельбургская ДХШ'
|
||||
|
||||
return {
|
||||
articles,
|
||||
nextPage,
|
||||
prevPage,
|
||||
pageUrl,
|
||||
title,
|
||||
meta: meta({
|
||||
props: {
|
||||
articles,
|
||||
nextPage,
|
||||
prevPage,
|
||||
pageUrl,
|
||||
title,
|
||||
url: pageUrl,
|
||||
})
|
||||
meta: meta({
|
||||
title,
|
||||
url: pageUrl,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default Page
|
||||
export default Page
|
||||
Reference in new issue
Block a user