Create a blog with nuxt.
- Add
@nuxtjs/blog
dependency using yarn or npm to your project - Add
@nuxtjs/blog
module tonuxt.config.js
:modules: [{ src: '@nuxtjs/blog', }]
Put your markdown articles/posts in blog
directory in project root.
Build your blog with @nuxt
This module works very well when I'm running in development mode, but when I go to generate a static site, there are a few issues that I've noticed.
/api/blog/posts/{slug}
which doesn't exist./api/blog/posts/{slug}
calls, but they are nested inside the public path directory (/_nuxt
) and they have a .json
extension added..json
files are not versioned in any way. This is not a 100% deal breaker, since the corresponding .html
files are no versioned either so they can share caching strategies, however it does go against the strategy of assuming everything in the pubilc path directory is versioned and thus can be cached for long periods.@nuxtjs/sitemap
module and don't appear within the sitemap.xml
file or the sitemap-routes.json
file.In the few days I've spent pulling apart code, I have not been able to figure out a way to resolve any of these issues, as this module is failry large and complex. I appreciate the capabilities but I don't know how useful it is without being able to function as a static file site. I'll continue to work on it as time allows but I would be very interested in knowing if there is some configuration that I'm missing that might make some of these pieces fall into place.
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.
Since we did not receive a CI status on the greenkeeper/initial
branch, we assume that you still need to configure it.
If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/
.
We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.
I start some app through some port.
package.json is like this.
"scripts": {
"dev": "nuxt -p=4400",
...
So after i installed blog module, i have to chage blog-module.js etc like this.
export default function NuxtModule(options) {
const defaults = {
base: 'http://localhost:4450', <<<<<<<<<<<<<
comments: false,
...
But this file is in node_modules directory.
Can i change above default port at nuxt.config.js ?
❯ npm run dev
> [email protected] dev /Users/simonwjackson/storage/code/sandbox/nuxt-blog-module-example
> nuxt
blog:api Listening on /api/blog 17:05:11
ERROR Cannot destructure property createHash of 'undefined' or 'null'. 17:05:13
at Object.<anonymous> (node_modules/extract-css-chunks-webpack-plugin/dist/index.js:27:5)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (node_modules/extract-css-chunks-webpack-plugin/dist/cjs.js:3:18)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
Nuxt rc11
Blog-module 0.0.1-6
on build Uglify fails
ERROR in 3.401771ae88b5828911b6.js from UglifyJs
Unexpected token: operator (>) [./node_modules/@nuxtjs/blog/src/app/mixins/api.js:7,0][3.401771ae88b5828911b6.js:111,20]
ERROR in 5.607bddffaeab0f9a14c9.js from UglifyJs
Unexpected token: operator (>) [./node_modules/@nuxtjs/blog/src/app/mixins/api.js:7,0][5.607bddffaeab0f9a14c9.js:100,20]
ERROR in 6.72fb925f626a18a70784.js from UglifyJs
Unexpected token punc «(», expected punc «:» [./node_modules/@nuxtjs/blog/src/app/mixins/collection.js:7,0][6.72fb925f626a18a70784.js:117,17]
ERROR in 7.d3452f4d13ebcec5cc93.js from UglifyJs
Unexpected token punc «(», expected punc «:» [./node_modules/@nuxtjs/blog/src/app/mixins/blog.js:6,0][7.d3452f4d13ebcec5cc93.js:77,17]
Looks like the code in the mixins is not run through babel before uglify tries to do what it needs to do, therefore is fails because it does not recognize the es6 arrow functions
There seems to be an issue running this module with Nuxt 2.8.0
/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/neo-async/async.js:16
throw new Error('Callback was already called.');
^
Error: Callback was already called.
at throwError (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/neo-async/async.js:16:11)
at /Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/neo-async/async.js:2818:7
at Compilation.processModuleDependencies (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/Compilation.js:725:4)
at afterBuild (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/Compilation.js:855:15)
at buildModule.err (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/Compilation.js:899:11)
at callback (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/Compilation.js:630:5)
at module.build.error (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/Compilation.js:678:12)
at handleParseError (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/NormalModule.js:453:12)
at doBuild.err (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/NormalModule.js:484:5)
at runLoaders (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/lib/NormalModule.js:343:12)
at /Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/loader-runner/lib/LoaderRunner.js:373:3
at iterateNormalLoaders (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/loader-runner/lib/LoaderRunner.js:214:10)
at Array.<anonymous> (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/loader-runner/lib/LoaderRunner.js:205:4)
at Storage.finished (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at provider (/Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/webpack/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
at /Users/justin.dasilva/Sites/dev/justindasilva/web/node_modules/graceful-fs/graceful-fs.js:90:16
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I get this error when I add blog module to my nuxtjs app.
Here is the list of modules from my nuxt.config.js:
modules: [ '@nuxtjs/axios', '@nuxtjs/blog', ],
Dependencies from package.json:
"dependencies": { "@nuxtjs/axios": "^5.9.5", "@nuxtjs/blog": "0.0.1-6", "nuxt": "^2.0.0" },
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.