EvanAgee / vuejs-wordpress-theme-starter

A WordPress theme with the guts ripped out and replaced with Vue.
https://vuewp.com/
1.6k stars 282 forks source link

How to set a specific page for the homepage? #55

Closed tomhrtly closed 4 years ago

tomhrtly commented 5 years ago

Is it possible to display a page for the homepage through the Home.vue file?

So for example if I had a page in WordPress called "Example" then when viewing the homepage of the site, it would show that page content instead of the content inside Home.vue.

Also I think it would be great to have a detailed documentation site for this project going forward, it would help developers such as myself who are new to Vue.js and if it could outline exactly how Vue is getting the data from the REST API that would be great.

For the time being, are their any articles that you would recommend looking at that would help to gain a better understanding of this project?

giekaton commented 5 years ago

Once again, I'm also having the same issue.

Everything works when I access pages through router-view or a direct url, but not sure how to load the dafault home page (and not hardcored welcome text) on the first load.

P.S. In my wp reading settings, I have selected the default static home page that needs to be loaded.

Also, I agree that it would be good to have these basic quickstart questions answered in the docs. This would save a lot of time for the users and for the creator of the repo, plus it would increase the adoption. Maybe some kind of FAQ. Here are another 2 questions-answers that can go to the FAQ.

EvanAgee commented 5 years ago

@tomhrtly it's absolutely possible and there are several ways you could go about it. The simplest would be to decide which page you want to display the contents of and then update the Home.vue component to pull in that page data from the API when it's mounted.

Your comment about the documentation is totally on point, I've got limited time but I think it would be super helpful to at least start a documentation site with examples of common issues and how to solve them.

tomhrtly commented 5 years ago

@EvanAgee I have copied the code from Page.vue to Home.vue, would I need to change these three lines to point to the slug/page I want to show on the homepage?

pageContent() { return this.page(this.$route.params.pageSlug); }

I've tried changing the value of pageSlug but I get some errors, I don't think I'm looking in the right place as well. Are you able to provide an example?

I would be willing to help with the documentation in any way possible, would be great to get one set up through Jekyll of some sort so we can all contribute where possible.