All Projects → yashha → Wp Nuxt

yashha / Wp Nuxt

Licence: mit
The module adds WP-API to your nuxt application.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Wp Nuxt

Nuepress
📖 Nuxt.js + WordPress REST API
Stars: ✭ 524 (+192.74%)
Mutual labels:  rest-api, wordpress, nuxt, frontend, ssr
Nuxt Wordpress Pwa
Wordpress + Vue + Nuxt.js
Stars: ✭ 251 (+40.22%)
Mutual labels:  wordpress, nuxt, ssr
Vue Slick Carousel
🚥Vue Slick Carousel with True SSR Written for ⚡Faster Luxstay
Stars: ✭ 447 (+149.72%)
Mutual labels:  nuxt, frontend, ssr
Sails Nuxt
Sails + Nuxt + Vuetify Combo <3
Stars: ✭ 92 (-48.6%)
Mutual labels:  nuxt, ssr
Bhagavadgita
A non-profit initiative to help spread the transcendental wisdom from the Bhagavad Gita to people around the world.
Stars: ✭ 84 (-53.07%)
Mutual labels:  rest-api, frontend
Spring Boot Mongodb Angular Todo App
A Sample App built using Spring Boot, Angular and MongoDB
Stars: ✭ 84 (-53.07%)
Mutual labels:  rest-api, frontend
Acf To Rest Api
Exposes Advanced Custom Fields Endpoints in the WordPress REST API
Stars: ✭ 1,152 (+543.58%)
Mutual labels:  rest-api, wordpress
Wp Rest Starter
Starter package for working with the WordPress REST API in an object-oriented fashion.
Stars: ✭ 105 (-41.34%)
Mutual labels:  rest-api, wordpress
Viewi
Powerful tool for building full-stack and completely reactive user interfaces using PHP
Stars: ✭ 93 (-48.04%)
Mutual labels:  frontend, ssr
Auth Module
auth.nuxtjs.org
Stars: ✭ 1,624 (+807.26%)
Mutual labels:  nuxt, ssr
Spring Boot Vuejs
Example project showing how to build a Spring Boot App providing a GUI with Vue.js
Stars: ✭ 1,818 (+915.64%)
Mutual labels:  rest-api, frontend
Vue Masonry Wall
A pure vue responsive masonry layout without direct dom manipulation and ssr support.
Stars: ✭ 79 (-55.87%)
Mutual labels:  nuxt, ssr
Nuxt Chat App
Frontend of real-time chat application built using nuxtjs, socket.io. Check the backend at https://github.com/binbytes/chat-app-server.
Stars: ✭ 77 (-56.98%)
Mutual labels:  nuxt, frontend
Laravel Woocommerce
WooCommerce Rest API for Laravel
Stars: ✭ 86 (-51.96%)
Mutual labels:  rest-api, wordpress
Bank
🏦 Full Stack Web Application similar to financial software that is used in banking institutions | React.js and Node.js
Stars: ✭ 1,158 (+546.93%)
Mutual labels:  rest-api, frontend
Naice Blog
😺 新的博客上线啦
Stars: ✭ 93 (-48.04%)
Mutual labels:  nuxt, ssr
React With Wordpress
🔥 Example of react application to access WordPress REST API
Stars: ✭ 137 (-23.46%)
Mutual labels:  rest-api, wordpress
Pop
Monorepo of the PoP project, including: a server-side component model in PHP, a GraphQL server, a GraphQL API plugin for WordPress, and a website builder
Stars: ✭ 160 (-10.61%)
Mutual labels:  rest-api, wordpress
Nuxt Env
Inject env vars for your Nuxt app at runtime
Stars: ✭ 169 (-5.59%)
Mutual labels:  nuxt, ssr
Snipcart Wordpress React
Strapping React.js on a WordPress Backend: WP REST API Example
Stars: ✭ 66 (-63.13%)
Mutual labels:  rest-api, wordpress

wp-nuxt

npm (scoped with tag) npm CircleCI Codecov Dependencies js-standard-style FOSSA Status Netlify Status

📖 Release Notes

Features

The module adds WP-API to your nuxt application.

The size of the library is 49,8 kB minified (14 kB gzipped). npm bundle size

Setup

  • Add wp-nuxt dependency using yarn or npm to your project

  • Add wp-nuxt to modules section of nuxt.config.js

{
  modules: [
    // Simple usage
    'wp-nuxt',

    // With options
    ['wp-nuxt', {
      endpoint: 'https://wp.kmr.io/wp-json',
      extensions: true // For additional functions of wpapi-extensions
      /* other options of WP-API */
    }],
 ]
}

Info: when you pass extensions: true you will have additional functions of wpapi-extensions available. For this you also have to install WUXT Headless WordPress API Extensions on your wordpress sever.

Usage

You can use the API of WP-API using the injected 'app.$wp'. (s. example)

Example

<script>
export default {
  async asyncData ({ app, store, params }) {
    return { articles: await app.$wp.posts().perPage(10) }
  }
}
</script>

Basic RSS feed integration

To use an automatically generated rss feed under /feed.xml you have to add following to your the nuxt.config.js. It will automatically fetch the posts from your rest endpoint provided in the options. (demo)

const wpNuxtFeed = require('wp-nuxt/lib/rss')

module.exports = {
  feed: [
    wpNuxtFeed({
      baseUrl: 'http://localhost:3000'
    })
  ]
}

To prevent injecting the default link tag into the head you can pass the option injectDefaultHead: false. Any options such as title or description can be overwritten through the function options. For more options look into the feed module and the definition of th function.

Basic sitemap integration

Using the module nuxtjs/sitemap a opinionated sitemap is provided by default.

Specific options can be overwritten like the following in the nuxt.config.js:

module.exports = {
  wp: {
    sitemap: {
      hostname: process.env.HOSTNAME // default; format e.g. 'http://localhost:3000'
    }
  }
}

It can be completely overwritten using the sitemap property in the nuxt.config.js and deactivated using following:

module.exports = {
  wp: {
    sitemap: false
  }
}

See more options in the extension nuxtjs/sitemap or in the following file

Custom Routes

You can register your own routes e.g. for custom extentions.

module.exports = {
  wp: {
    endpoint: 'https://wp.kmr.io/wp-json',
    customRoutes: [
      {
        extension: 'wp/v2',
        route: 'custom-taxonomy',
        name: 'customTaxonomy'
      }
    ]
  }
}

This will call wp.customTaxonomy = wp.registerRoute('wp/v2','custom-taxonomy' and make it available as app.$wp.customTaxonomy()

Auto-Discovery

For more infos: https://github.com/WP-API/node-wpapi/tree/master#auto-discovery

module.exports = {
  wp: {
    endpoint: 'https://wp.kmr.io/wp-json',
    discover: true // To auto-discover routes by url provided in 'endpoint'
  }
}

Info: Make sure to handle CORS correctly. s. https://github.com/WP-API/node-wpapi/tree/master#cross-origin-auto-discovery

Browser Support

IE11 seems to work, but throws errors. (Help wanted)

License

MIT License

Copyright (c) yashha

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].