Giter VIP home page Giter VIP logo

nextein's People

Contributors

delgermurun avatar dependabot[bot] avatar elmasse avatar greenkeeper[bot] avatar knoebelja avatar monkeywithacupcake avatar sco avatar snyk-bot avatar zelphir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nextein's Issues

Custom output directory name

I had being looking for a way to create a custom name for the output directory and can't find it.

My use case would be something like creating a GitHub page with nextein to hold the source code and the output directory being a git submodule with static files.

So the nextein would be something like <username> and the submodule <username>.github.io so I would like the create the output of the export process inside that directory instead of the out one.

Use MDX

MDX is an awesome extension to Markdown to be able to add JS code and even React componentes inside a Markdown file (.mdx).

It would be awesome if nextein could use MDX natively so if you use normal MD it will work as usual but you can also extend it.

possibility to change /posts folder

I want to create a site with multiple authors and categories with information on their own. I think the best way to achieve it would be some kind of content folder, that wraps around it.

is this possible with any current configuration?

imagined folder structure:

└── content
    ├── posts
    │   ├── post1.md
    │   └── post2.md
    ├── authors
    │   ├── author1.json
    │   └── author2.json
    └── categories
        ├── category1.json
        └── category2.json

Client side support

Hi @elmasse,

Great job. Thank you for doing it.

I was thinking about doing this kind of product and actually done prototype.

Even though it static site generator, how about adding client side support?
By client side support, I mean rendering next pages on the client side, after initial load. Next has this feature for exported static sites too.

It loads next pages faster and nice UX experience to have.

I ported my prototype to nextein and it works great. https://github.com/delgermurun/delgermurun.mn

Plugin system

We should be able to add and configure different plugins instead of using rehype/remark. This will open the door for adding support for formats other than markdown and also provide a way to configure the posts folder.

The idea is to not break any existing codebase that uses nextein so by default the nextein-rehype-plugin (name can be discussed, also nextein-markdown-plugin is being considered) will be included and default configuration to current values.

  • Create plugin system that reads from next.config.js
  • Define a plugin API (What's the plugin responsibility and what data structure it should handle/provide) alongside with process.
  • Implement mardown plugin to move current logic into it.
  • Update tests.
  • Update Readme

SyntaxError: missing ) after argument list

Hi, I try the Getting Started but I have an error when run npm run dev

/Volumes/lavaldi/repos/personal-blog/node_modules/nextein/dist/bin/nextein-dev:58
srv.start(argv.port).then(async function () {
                          ^^^^^

SyntaxError: missing ) after argument list
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:389:7)
    at startup (bootstrap_node.js:149:9)

npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v6.11.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] dev: `nextein`
npm ERR! Exit status 1

package.json

"dependencies": {
    "next": "^3.2.2",
    "nextein": "^1.0.0-beta20",
    "react": "^15.6.1",
    "react-dom": "^15.6.1"
  }

Add support for next page to use nextein/link to load a page with posts.

Use case:
Have an index page that renders a next page. Include a nextein/link to a blog page with a list of posts.

pages/index.js

import React form 'react'
import Link from 'nextein/link'

export default () => (
  <div>
    <h1>Hello There</h1>
    <p>This is a very simple component. With a link to <Link href="/blog"><a>My Blog</a></Link></p>
  </div>
)

pages/blog.js

import React from 'react'
import withPosts from 'nextein/posts'
import { Content } from 'nextein/post'

export default withPosts(({ posts }) => {
  return (
    <main>
    {
      posts.map((post, index) => (        
        <article key={`post-${index}`}>
          <h1>{post.data.title}</h1>
          <Content {...post} />
        </article>
      ))
    }
    </main>
  )
})

RSS support

Need a way / example on how to generate a feed.xml

Filter posts without content

Hey,

currently i'm rebuilding my blog with nextein and want to make a suggestion for filtering the posts. The content is in my case huge for every posts item. About 15000-40000 chars for each of my 180 posts.
Maybe we can add an option to inCategory like {removeContent: true} to delete the content from the posts object.
A commom use case is to render a list with urls for posts in a category. So we don't need the content.

Writing HTML tags inside markdown files

Sometimes I just want to write normal HTML tags inside markdown in order to style them in a certain way, but I noticed that all HTML tags written in markdown are escaped in nextein.

Is there a way to achieve what I wanted?

Update remark

Hiya!

remark changed a few weeks ago and I just wanted to let you know!

I also just checked your code and came up with two ideas, do with them whatever you’d like 😉

use unified directly

You’re now importing remark directly, but that contains an unneeded markdown compiler/generator/stringifier. You could make stuff a bit lighter if you’d apply the following changes:

Now:

  remark()
    .use(excerpt && extractExcerpt)
    .use(reactRenderer, {
      prefix: `entry-`,
      remarkReactComponents: renderers
    })
    .processSync(content).contents

Proposed:

  unified()
    .use(remarkParse)
    .use(excerpt && extractExcerpt)
    .use(reactRenderer, {
      prefix: `entry-`,
      remarkReactComponents: renderers
    })
    .processSync(content).contents

use rehype

Markdown has an interesting feature: just paste in HTML and it’ll turn out great. However, if you use it, it breaks a lot of stuff in markdown. Instead, I suggest using rehype through remark-rehype, rehype-raw, and rehype-react. It gives you much better support for HTML, and rehype has some interesting other plugins (caveat: svg isn’t really supported).

setting page index in front matter

i'm trying to port my metalsmith blog over a metalsmith generated static-site to nextein. i have a markdown file with content for the home page. but assigning page: index won't allow me to find the post with withPost() on page/index.js. any ideas on how i could resolve this?

issue with hot reload and styled-components

I had some major headache yesterday with hot reloading being wonky. Style changes in styled-components wouldn't load as expected. I had to click on another page and then back again to trigger a rebuild. Turned out it was because I used "dev": "nextein" as suggested in the readme and as used in nextein-example.

Since I had to dig around the source to find that you can add a dev argument, maybe it should be added to the readme and perhaps also changed in nextein-example?

What's the use case of running nextein without the dev argument?

static assets reloading

Hey elmasse, love nextein!

I'm having an issue where my static assets are reloading whenever I navigate from post to post.

Not working with next.js@canary

$ nextein
TypeError: Cannot read property 'exportPathMap' of undefined
    at Server.readEntries (/Volumes/Data/Workspace/MyWeb/node_modules/nextein/dist/server.js:100:50)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)
    at Function.Module.runMain (module.js:705:11)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:660:3
error An unexpected error occurred: "Command failed.
Exit code: 1
Command: sh
Arguments: -c nextein
Directory: /Volumes/Data/Workspace/MyWeb/web
Output:

@elmasse

Needed to update to next@canary to fix the export command when using withCss or withSass plugins. Running npx next works fine but of course doesn't generate all the posts from markdown

Don't load all posts when rendering a single post page

When you try to load a single post page (which use withPost), you can notice that the page will include all posts in the __NEXT_DATA__ object. Is it possible to omit all other entries and load only the data necessary to render the single post ?

If you try for example to open http://localhost:3000/first-post the content from all other posts will be loaded into __NEXT_DATA__ as well. This behaviour isn't wanted if you have a large collection of posts, since opening a single post will download some MB before rendering the page.

#4 and #125 seems to be in some way related with this.

Custom route

Is there a way to have a custom route in a Nextein app? I want to have a separate URL for each category, such as /food, /cars, /news, etc. I tried exporting each of them dynamically in next.config.js, but it still errors with 404 when loading a URL directly (not via <Link>).

const path = require('path');
const fs = require('fs');
const nexteinConfig = require('nextein/config').default;

module.exports = nexteinConfig({
	exportPathMap: () => {
		const categories = fs.readdirSync(path.join(__dirname, 'posts'));

		return categories.map(name => ({
			[`/${name}`]: {
				page: '/category'
			}
		}));
	}
});

Post: Implement permalink in post front matter

To make Nextein compatible with Jekyll posts the generated url should include .html and also remove the date from the file name.

Add an opt-in option to post front matter for using .html

---
useExtension: true
---

Hot reload on Markdown files edits

I was expecting this out of the box as this is clearly a must-have feature. So, I'm not sure if missed some config option or this is just not supported yet?

TypeError: Cannot read property 'filter' of undefined

Hi,

First of all, thanks for nextein! It's amazing!

I'm running into this issue though. It only happens when deploying my site via now, not when running locally. When I open a page that is using withPostsFilterBy for the first time via a nextein <Link> I get an error in the console:

Cannot read property 'filter' of undefined
TypeError: Cannot read property 'filter' of undefined
    at Function.value (https://out-qsowcegedz.now.sh/_next/dec5f7f2-4a3e-44b9-8e02-75a7abd04637/page/blog/index.js:3:2566)
    at <anonymous>

Navigating back and clicking on the link again works though.

The error seems to happen because loadEntries() returns undefined:

const all = await loadEntries()
const posts = filter ? all.filter(filter) : all

Source seems to be the client version of loadEntries:

if (__NEXT_DATA__.nextExport) {
return __NEXT_DATA__.props.posts
}
const resp = await fetch('/_load_entries')
return resp.json()
}

I'm trying to dig deeper into the issue myself atm but my JS debug skills are noobish. Just wanted to report to see if this is a known issue.

Thanks

SSR caching

Is it possible to add SSR caching (for assets) with Nextein? I would like to set a few headers to cache things like custom fonts, stylesheets, etc. so that they are not reloaded on each visit. At the moment I do not see a clear path for caching with Nextein.

Would this require creating a custom server? Next provides an example for SSR caching which does, in fact, require setting up a custom server.

Are there any options to extend SSR this with the next.config.js file or other?

Thanks!

Get category from dir structure

Hi,

awesome project! How about this: instead of defining the category in each post, we could define it with the dir structure like this:

├───posts
│   ├───cat-1
│   │  └───post-cat-1.md
│   ├───cat-2
│   │  └───sub-cat-2
│   │     └───post-sub-cat-2.md
│   └───post-cat-2.md

The posts would be available via:

  • /cat-1/post-cat-1
  • /cat-2/post-cat-2
  • /cat-2/sub-cat/post-sub-cat-2

Add id tags to headers when converting from markdown.

In-page anchoring doesn't work without injecting <h2> elements with id tags into markdown. In-page anchoring should work and usually does work with markdown out of the box. How difficult would this be to add to nextein?

HMR not working on /pages for projects named *.github.io

There is a reported issue with next v7.0.2 (vercel/next.js#5429) that prevents HMR to work with projects that contains .git in the name.
I'm posting this to keep track of the issue resolution and for future reference the quick workaround is to set the webpackDevMiddleware watchOptions as follows using next.config.js:

module.exports = {
  webpackDevMiddleware(config) {
    config.watchOptions = {
      ignored: [
        /\.git\//,
        /\.next\//,
        /node_modules/
      ]
    }
    return config;
  }
}

List of categories

I'm trying to generate a list of categories as a navigation on a blog. Even though there seems to be no built-in method to get those, I can extract them from posts prop in a component wrapped with withPosts. The problem comes on a page for a specific post, where I have access only to post, but not posts. Is there a workaround for this? Perhaps list categories using fs.readdir on the server and expose that data to a client?

improve package.json info

Information in package.json

  • add description
  • add github repo url
  • add issues url
  • add keywords
  • move index.js -> posts from main or remove main

An in-range update of next is breaking the build 🚨

Version 6.1.0 of next was just published.

Branch Build failing 🚨
Dependency next
Current Version 6.0.3
Type devDependency

This version is covered by your current version range and after updating it in your project the build failed.

next is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push The Travis CI build could not complete due to an error Details

Release Notes 6.1.0

Minor Changes

  • Add class properties configuration: #4619
  • Rename dist to server to be more consistent: #4506
  • Remove react-hot-loader: #4500
  • Allow onClick on next/link component's child: #4474
  • Added "hashChangeStart" and "hashChangeComplete" events: #4234

Patches

  • Make production compilation faster: #4677
  • Move plugins and loaders to webpack folder: #4618
  • Pass in the generated asPath instead of a full url: #4622
  • Failing test for #4620: #4625
  • Remove the React 15 support comment: #4648
  • Rephrase url deprecation text and add link to next-codemod: #4649
  • Update "url deprecated" error docs with note re: React Dev Tools: #4652
  • Remove unneeded async: #4635
  • Fix incorrect wording: #4658
  • Pass through buildId to webpack config in development: #4665
  • Only log out using external babelrc once: #4600
  • Apply hot-self-accept to all pageExtensions: #4616
  • Process available chunk names properly in dev mode: #4604
  • Update README.md to include browser support and polyfills docs: #4601
  • Catch errors thrown in _app.js: #4607
  • Move build directory outside of server folder: #4565
  • Properly escape the dot character in regexp: #4608
  • Next/head allow duplicates if it has uniq keys: #4121
  • Remove deprecated and removed route: #4509
  • Add CONFIG_FILE constant, add types for server/config.js: #4529
  • Remove uglify options in preparation of webpack 4: #4536
  • Clean up references to this.dir and this.dist everywhere: #4535
  • Make router properties update when re-rendering: #4541
  • Add dependencies of _app.js to commons: #4396
  • Use a more appropriate regexp for removing hash from a filename: #4510
  • Fix Access-Control-Request-Method header: #4424
  • Upgrade update-check: #4585
  • Add check for added/deleted pages: #4497
  • Default query to {}, same behaviour as next export: #4466
  • Add title to default error page: #4383
  • Add section to the readme about configuring .babelrc: 4e8009c
  • Clarify documentation regarding the static folder: #4340
  • Improve issue templates: 7193f49
  • Make sure index of issue template is correct: e6f3542
  • Fix(bin/next:inspect): Allow node inspect flag to be used: #4160
  • Fix dynamic import in non webpack env: #4208
  • Improve route prefetch docs: add client side imperative code: #4213
  • Fix generated page chunk when libraryTarget is umd: #4205
  • Don’t use chunkhash in development: #4436
  • Use custom Babel loader to avoid using separate Babel copies for loader and loader options: #4417
  • Remove note about exportPathMap not being supported in development: 13cf942
  • Update with-url-object-routing: #4314
  • Improve files list order in package.json: #4399
  • Minor improve with-typescript example [ci skip]: #4402
  • Add example with next-page-transitions: #4404
  • Fix and improve example : with-componentdidcatch: #4400
  • Example updated: with-apollo-auth to Next 6: #4420
  • Set cache-control public correctly: #4322

Examples

  • Update with-universal-configuration: #4624
  • Added with-unstated example: #4628
  • [with-jest] Move jest deps to devDeps: #4650
  • With-socket.io Example updated with _app.js: #4644
  • Add example to Recipes section: #4661
  • Update with-markdown example: #4612
  • With-styled-components: Move babel plugin to dev dependency: #4602
  • Update with-absolute-imports example to Babel 7: #4610
  • Fixes bug in with-react-intl example: messages and locale variables were undefined on CSR: #4517
  • Upgrade with-jest-typescript example to next 6.0.0: #4543
  • Stop duplicating charset: #4546
  • Added example for Ant Design with LESS: #4520
  • [with-apollo-auth] Remove useless apolloState from App's props: #4554
  • [with-apollo-auth] Remove useless check from constructor: #4560
  • [with-apollo-auth] simplify apolloState prop: #4563
  • Upgrade gh-pages example to next 6.0.3: #4575
  • With-firebase-hosting: fix npm scripts, remove firebase.json predeploy scripts: #4593
  • Clean up Redux example: #4594
  • Remove unused import: #4493
  • Fix README typo: #4476
  • Add with-next-less example: #4492
  • Added support flex: 1 and and tag support Dimensions in with-react-native-web: #4460
  • Fix viewport issue in with-react-native-web: c461d46
  • Sitemap.xml and robots.txt example: #4163
  • Update typescript examples to use 1.0.1 of next-typescript: #4472
  • Improve custom server typescript example v2: #4470
  • 📝️Restructure with-material-ui per #4439: #4444
  • Create with-firebase-hosting-and-typescript example: #4443
  • With-firebase-hosting: update to work with next v6: #4435
  • update to with-apollo-auth: #4426
  • Fixed error with the cookie parser in with-apollo-auth: #4445

Credits

Huge thanks to @ex3ndr @teleginzhenya, @Zn4rK, @bennygenel, @brikou, @scaasic, @oliviertassinari, @fatfisz, @andrewmclagan, @koss-lebedev, @davscro, @tobitos, @ngauthier, @skv-headless, @rovansteen, @giautm, @swissspidy, @teleginzhenya, @jthegedus, @lon-io, @mmiszy, @vasco3, @dlcoffee, @quietshu, @klyburke, @toolmantim @gHashTag, @TheRobBrennan, @lukebarton, @tvthatsme, @joaogranado, @rwieruch, @andy-viv, @AriLFrankel, @vladnicula, @JeromeFitz, @elrumordelaluz, @Yuripetusko, @yhirano55, @nwalters512, @lucleray, @lfades, @jonespen, @sampsonjoliver, @DevSpeak, and @loganfsmyth for helping!

Commits

The new version differs by 103 commits.

  • 512f16e 6.1.0
  • 7fcfb8b Make production compilation faster (patch) (#4677)
  • 1ebd996 6.0.4-canary.9
  • 85769c3 Pass through buildId to webpack config in development (#4665)
  • e70c595 Add example to Recipes section (#4661)
  • 36c82fd Fix incorrect wording (#4658)
  • 6ed2da4 with-socket.io Example updated with _app.js (#4644)
  • f4af03b Remove unneeded async (#4635)
  • 91900d1 Update "url deprecated" error docs with note re: React Dev Tools (#4652)
  • 0989ecc [with-jest] Move jest deps to devDeps (#4650)
  • 3ae9f87 Rephrase url deprecation text and add link to next-codemod (#4649)
  • 6cba9fa Remove the React 15 support comment (#4648)
  • 67cb87a Added with-unstated example (#4628)
  • fc2d59d Add class properties configuration (#4619)
  • bf882eb Failing test for #4620 (#4625)

There are 103 commits in total.

See the full diff

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Update to next js 6.0.0

  • Include next 6.0.0 in package.json peer dependencies
  • needed to remove
    require('source-map-support/register');
    from bin/nextein-dev script

Posts pagination

Is pagination for posts on your plans? It would be a great feature to have.

Not merging with defaultPathMap?

I successfully followed step 3 of the tutorial, but when I export my static website all the routes that were previously auto-generated by Next are available no more, I have to re-declare them explicitly like so:

exportPathMap: defaultPathMap => ({
  ...defaultPathMap, // this doesn't even work
  '/blog': { page: '/blog' },
  '/about': { page: '/about' }, // this was auto-defined before using nextein
}),

I'm using next ^7.0.1 and nextein ^2.0.0.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Fetching post data

Hey @elmasse,
I'm still loving nextein!

Currently, we can use withPosts to to grab all of the posts content and data.
Is there a plan to make it so only the data without the content is fetch-able?

This kind of feature would be really cool for dynamic sidebars and pagination!

An in-range update of react is breaking the build 🚨

There have been updates to the react monorepo:

    • The devDependency react was updated from 16.6.1 to 16.6.2.

🚨 View failing branch.

This version is covered by your current version range and after updating it in your project the build failed.

This monorepo update includes releases of one or more dependencies which all belong to the react group definition.

react is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.

Status Details
  • continuous-integration/travis-ci/push: The Travis CI build could not complete due to an error (Details).

FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.