How does static site generator work with a CMS like wordpress - wordpress

I have been exploring using Vue for wordpress frontend, and I came across so many different technologies, like Nuxt.js, Gridsome, VuePress, and they help to create sites into SPA, SSR, or static sites. I really like these ideas, because I want to move into modern frontends instead of using the WordPress default. So I am looking into headless WordPress.
After some research, I think I kind of like Gridsome with Wordpress, as Gridsome helps to build static site by compiling content from CMS and templates at build time.
So I have a very newbie question, CMS like wordpress gets updated everyday by users, to update pages, add new posts etc, does that mean you need to build the site every time people add some content to the CMS?
I'm going to build a sort of internal portal, with WordPress and I want to try out Vue, so with all these technologies out there, I am lost at what framework best suit my project with dynamic content.
Any suggestions or insights? Thanks.

So I have a very newbie question, CMS like wordpress gets updated everyday by > users, to update pages, add new posts etc, does that mean you need to build the > site every time people add some content to the CMS?
Yes that's the concept of a statically generated site.
Still it's a choice of how you design your application.
Normally when a new post is created there can be an event / webhook triggering a build job which would automatically build and deploy the page with the latest post.
Still you can have in your deployed application client side Vue components which call the API directly to retrieve data and display it. For example for the comments it could make sense to do this.
Netlify is a good example which has the whole static site generation eased up with a nice CI / CD which can be triggered automatically as soon as your site. They also have a CMS which works on top of markdown files. As soon as a changed / new markdown file is commited to the repository it triggers a build to deploy the latest version of the page.
I hope this helps.
Thanks and best regards,
ewatch

Related

If a website is constantly changing, can it be implemented with next.js?

I hope you are doing well
I want to make a book site with next.js. My site needs to be updated and add products every day. I want to know now if it is appropriate to make this site with next.js?
Now, my website is complete and I ran it with next.js, my website is with node.js, and now every product that I add, I have to go and get a build from the next.js project and upload it to the host, and is this a difficult job? If anyone has a better way, I would be grateful if they could help
Look at this Showcase on next.js official website. It's powerful enough to make any kind of dynamic website. You need to use getServerSideProps with the database of your choice. If you are using Static HTML Export you have to rebuild and upload it again whenever you make any changes.
There's also a lot of options to automate next.js deployment, Best option for your use case is to use services like Digital Ocean App Platform so whenever you push some changes to git repo it automatically rebuild and update your site with fresh content.

Mixing Wordpress eCommerce site with external login based Vue Frontend Best Practices

I am new to web development and and would like advice about what is the usual best practices to achieve what I am trying to do.
I am in charge of writing a frontend app using Vue. This frontend will require a login to access the app. The app will be hosted on Amazon.
However we are also wanting to build an eCommerce site in Wordpress or equivalent that sits on the root of the website, (eg www.mywebsite.com) with the app accessible through a "sign in" button. If the user presses the sign in button we want the location bar location to not change from the website they are on (www.mywebsite.com), even though the Wordpress site and Vue frontend may be stored on different locations/domains.
If the site is made in Wordpress, we can get another developer to do that webpage for us, while I work on the frontend. However we want the experience to be relatively seamless between connecting to the wordpress root site, clicking on the sign in button and being taken to the Vue frontend.
Is this possible? Do both sites have to be hosted on the same server for it to work (eg an Amazon EC2 server which hosts two webpages, the wordpress one and the vue one)?
Or can the wordpress put a link to the Vue frontend which doesn't change the web location to the user?
Or (worst case scenario) do we need to make both webpages in Vue as one Vue application, some pages requiring login to access and others not?
Thanks kindly for any assistance.
So in order to use Vue and WordPress together, you can either write 2 separate applications. One for the Frontend and one for the Backend, which is perfectly fine or you can simply write a WordPress Application with a Vue Theme.
This is how this could look like:
WordPress Backend
You can use a normal WordPress backend, where you can build the architecture you want to. In addition, you need to set up the REST-API Wordpress provides. So this also means, just use plugins which support it. Otherwise, you would need to write custom endpoints. For example, Woocommerce would be a good e-commerce plugin, since it supports the API.
Learn more about it here: https://v2.wp-api.org/
Of course, you can host your WordPress installation on Amazon. Here is a good guide for that: https://aws.amazon.com/de/getting-started/tutorials/launch-a-wordpress-website/
Notice: The REST-API is available in core since 4.7. If you are using an older version you would need to install a plugin.
WordPress Frontend
In order to create your Frontend, I'd recommend you to make a custom theme. Since you are just serving static files this can be done pretty easy. But still, you don't need to reinvent the wheel.
There's a really good starter theme out there: https://github.com/EvanAgee/vuejs-wordpress-theme-starter
It comes with all the stuff you need to get started and since it is just a theme, you can simply set up a usual WordPress hosting without handling Domains of multiple applications.
In order to get the data from the Backend, you would simply make calls to the REST-API. Here's an example: https://github.com/EvanAgee/vuejs-wordpress-theme-starter/blob/master/src/api/index.js

Building a website for a hotel - is WordPress the best idea?

I'm researching to see if building a full website for a hotel be a good idea to do on WordPress.
I read that wordpress is okay but there are better options.
I want to design and code my own front end look to the website, but have the backend on a stable platform that can take all the reservations seamlessly.
My main concern is to be able to have a backup of all the files and easily switch to another server in case something goes wrong.
I can host the website on my server or host with the service you suggest that comes with the platform all together.
Any ideas and/or suggestions are greatly appreciated!
There are other options, no doubt, but yes, it can and is really possible to build it using WordPress as CMS.
If you want to design and code your own theme, you'll need to study the WordPress Theme Structure and, since you'll build it by yourself, you'll also need to develop plugins to create custom post types (aka CPT) to make the hotel management easier on the WP back-end.
About the theme structure, files, child themes and everything, I'd recommend you to read https://codex.wordpress.org/Theme_Development
About the plugins development: https://developer.wordpress.org/plugins/
About Custom Post Types: https://developer.wordpress.org/plugins/post-types/registering-custom-post-types/
About the backup: it's super easy and you can even make a full backup using free plugins via back-end. But if the site goes down you can easily do it via FTP downloading only wp-content folder and the database. It's really simple to migrate from one WordPress to another, or from host to host.
About the hosting, you'll need to use a server if you want to build this project. There's a difference between wordpress.com and wordpress.org
The .com is simpler, you are not able to build everything you want. The .org is the open source project, which you get the files, upload to your server and connect to database (MariaDB or MySQL). Most hosts offer automatic installation for WordPress and, from there, you can change whatever you want and need.
Note: many developers create CPTs INSIDE the theme's code, but this is not recommended by WP as you can see in We recommend that you put custom post types in a plugin rather than a theme. This ensures that user content remains portable even if they change their theme.
WP is not really hard, after 1 week studying you'll see yourself getting over most difficulties. Even if it takes longer, don't give up. There's a huge community to help you with WP questions.
Hope it helps and I'm sorry my bad writing, I'm not an english native speaker.
C ya

How to version control with WordPress

I want to set up a system where a developer can work on a separate server on a wordpress website.
My question is: If in the meantime changes are made to the live site (like plugin updates, new plugins, new posts, new comments, etc), how is one able to import a new feature (e.g. a new page) from the development server on the live site while making sure that previous changes on the live site don't get deleted?
I am looking to understand how this all works. In a sense, I would like to have some kind of version control system.
Thanks in advance :)
You can version control your own code using git. Basically we would init a new git repo and commit changes onto this repository. This can lie separately outside of the core files. i.e you only need to include the wp-content directory and ignore all the other core wordpress files.
Here is a good article on how to do a really good versioning system for a website.
http://toroid.org/git-website-howto
The posts and pages (basically content) in a wordpress site however lies in the database.Any changes made there will be permanent.
The only option is to keep taking regular backups of the content. You can do this by using an automated backup tool.
If you really want to version control your database, here is an article that helps:
https://blog.codinghorror.com/get-your-database-under-version-control/
This one is a tricky one. You cant host a single website on two servers. Just imagine a website having 2 hosted urls..!! No way.. You can never do that.
You better create a new user and give access to him. Look carefully in the settings and be a admin. You will have a chance to approve or reject what the second user changes.
Hope this helps.

Using wordpress as external content management system

We are planning to create an asp.net website (probably mvc), that needs a cms for news items.
Our content managers and others who require to publish news have asked if they can use wordpress for content management.
Our users have different roles, and news items should be visible to certain roles, or even specific users if possible.
The reason they want wordpress is the manager's user friendliness, so if some other alternative with the same kind of user experience would be ok.
Could anyone please point me in some direction?
NOTE: I'm still doing research at the moment, so I've got nothing holding me back at this point.
There is an API plugin that has been developed to spit out information in JSON, but I have not actually implemented a site with it:
http://wordpress.org/extend/plugins/json-api/
Perhaps you could have the authors work on a wordpress install and create your app to draw content via that plugin?
I too was facing the same issue, little different. We want to have WP as CMS so that our site can take the benefit of SEO which is very easy with WP. SO we installed WP under a folder in the Main ASP.net based website. Initially there were issues, I was unable to run it. Finally managed to run it. Solution is posted here - http://www.wwwlabz.com/how-to-run-a-php-based-website-from-a-subfolder-in-asp-net-website. Hope it will help someone. Actual site where we implemented this is http://www.periproperties.com/content/.
Now I want to have specific section of WP to be accessible on my site. SO I am exploring different options and will post, if found something
Thanks.
DotNetNuke is the most popular ASP.NET based CMS (source). I am implementing my first project in it and so far I am very happy with it.
Note the free edition will not work for you since you need customizable security roles and free has a limited set of predetermined roles. You'll need the pro edition.
I don't know how similar it is to WordPress. Overall, WordPress is much more popular but of course there are platform issues with WordPress since it is Apache based and you want to create an ASP.NET website.

Resources