make sure date later than now will now be publish
This commit is contained in:
1 parent
9ea60c68c7
commit
d8161be401
47 files changed
+25
-11589
No files matched your search
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"editor.defaultFormatter": "rvest.vs-code-prettier-eslint",
|
||||
"editor.formatOnSave": true
|
||||
}
|
||||
+15
-22
@@ -1,30 +1,23 @@
|
||||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
|
||||
Almost classless Next.js template (with TypeScript, ESLint, Prettier) powered by awsm.css
|
||||
|
||||
## Getting Started
|
||||
Tested with Yarn and Node.js 12.
|
||||
|
||||
First, run the development server:
|
||||
## Needed files
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
You will need these files and folders, either at `./content/` or `../../`
|
||||
|
||||
```sh
|
||||
_post/ # => will be parsed to /build/db.loki and /build/idx.json
|
||||
_media/ # => will be copied to /public/media/
|
||||
theme.yml # => will be parsed to /build/theme.json
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
The structure of `theme.yml` can be seen at [/server/theme.ts](/server/theme.ts).
|
||||
|
||||
You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file.
|
||||
Markdown files should be put `_post/`, with YAML frontmatter required keys - `title`. `date` < NOW is required to be "visible" in the listing (at `${baseUrl}/blog`, `${baseUrl}/tag`). For more information, please see [/server/db.ts](/server/db.ts).
|
||||
|
||||
## Learn More
|
||||
## Features
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
||||
|
||||
## Deploy on Vercel
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/import?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
||||
- Search engine with `lunr.js`
|
||||
- Commenting engine with `remark42`
|
||||
- Analytics with `plausible analytics`
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@zhdiary/next",
|
||||
"name": "@patarapolw/next-awsm",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
@@ -58,4 +58,4 @@
|
||||
"style": "module"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
||||
paths: Array(
|
||||
Math.ceil(
|
||||
dbPost.find({
|
||||
date: { $exists: true } as any
|
||||
date: { $lt: new Date().getTime() }
|
||||
}).length / 5
|
||||
) - 1
|
||||
)
|
||||
|
||||
@@ -35,7 +35,9 @@ export const getStaticPaths: GetStaticPaths = async () => {
|
||||
await initDatabase()
|
||||
const tMap = new Map<string, number>()
|
||||
|
||||
dbPost.find().map(({ tag = [] }) => {
|
||||
dbPost.find({
|
||||
date: { $lt: new Date().getTime() }
|
||||
}).map(({ tag = [] }) => {
|
||||
return tag.map((t) => {
|
||||
return tMap.set(t, (tMap.get(t) || 0) + 1)
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user