r/Gridsome • • Nov 27 '20

Gatsby vs Gridsome – How to Choose Best Static Site Generator?

Thumbnail
tekkiwebsolutions.com
0 Upvotes

r/Gridsome • • Nov 16 '20

Problem getting GraphQL to work with an external REST API

3 Upvotes

I've tried Googgling, reading the docs and trying the Discord. None of which helped so I'm desperate.

My gridsome.server.js looks like this:

// This is for creating the graphql queriable data...

api.loadSource(({ addCollection }) => {
// Use the Data Store API here: https://gridsome.org/docs/data-store-api/
})
api.createPages(async ({ createPage }) => {
const { data } = await axios.get('https://members-api.parliament.uk/api/Location/Constituency/Search?skip=0&take=20')
data.items.forEach(item => {
createPage({
path: \/constituency/${item.value.id}`,component: './src/templates/Constituency.vue',context: {id: item.value.id,name: item.value.name,startDate: item.value.startDate}})})})`

// This is for generating static pages.
api.loadSource(async actions => {
const { constituencies } = await axios.get('https://members-api.parliament.uk/api/Location/Constituency/Search?skip=0&take=20')
const collection = actions.addCollection({
typeName: 'Constituencies'
})
for (const constituency in constituencies) {
collection.addNode({
id: constituency.id,
name: constituency.value.name,
startDate: constituency.value.startDate
})
}
})

Good news: It creates pages for constituencies.

Bad news: When I try doing queries with the GraphQL explorer I get the following error:

{ "error": { "errors": [ { "message": "Cannot query field \"name\" on type \"Constituencies\".", "stringified": "Cannot query field \"name\" on type \"Constituencies\".\n\nGraphQL request:6:9\n5 | id\n6 | name\n | ^\n7 | startDate" }, { "message": "Cannot query field \"startDate\" on type \"Constituencies\".", "stringified": "Cannot query field \"startDate\" on type \"Constituencies\".\n\nGraphQL request:7:9\n6 | name\n7 | startDate\n | ^\n8 | }" } ] } }

I wanted to be able to create a search feature and that means having the GraphQL and querying side of things working. Its great I can create static pages - whoopee - BUT I want to create a search that also uses the API that I can put <page-query> blocks into pages with results for a particular search. But according to the graphQL queries the only available field is "id". Even though I'm using loadSource which I thought should create a GraphQL queriable set of data from the API?

Can anyone help?


r/Gridsome • • Oct 15 '20

Is it possible to use Vue 3 with Gridsome

3 Upvotes

Hi. I am trying to settle on a stack to use for a side project and I am liking the idea of JAM stack using Gridsome, as I prefer Vue to React. I'd like to use Vue 3 for this project, but I am unclear as to whether Vue 3 can be used. I guess the Gridsome scaffolding sets things up to use Vue 2 ??

Is it just a case of changing some references?

Any pointers to articles or direct help would be much appreciated.

Thanks in advance.


r/Gridsome • • Feb 16 '21

How To Trigger a Scroll Event in Vue.js

Thumbnail
medium.com
2 Upvotes

r/Gridsome • • Mar 01 '21

I am new to gridsome I was highly impressed by gridsome speed I want to use gridsome but issue is how do I host gridsome projects if I use gridsome + prismic how I host it can someone share youtube link of how to host it

2 Upvotes

r/Gridsome • • Oct 26 '20

What do you use most often? Props or Slots?

Thumbnail
medium.com
3 Upvotes

r/Gridsome • • Jan 09 '21

Anyone know how I can import a Wistia gallery into a Gridsome site?

1 Upvotes

Hey all,

I am building a JAMstack website using Gridsome. I want to embed a video gallery on one of the pages. However, I don't know how or where I should put the embed script or if I need to use a specific plugin to import it. Anyone out there able to help with this?

Here's the wista script I'd like to use:

<script src="https://fast.wistia.com/assets/external/channel.js" async></script><link rel="stylesheet" href="https://fast.wistia.com/embed/channel/project/x2dhyl75kf/font.css" /><div class="wistia_channel wistia_async_x2dhyl75kf mode=inline" style="min-height:100vh;position:relative;width:100%;"></div>

Thx!

SV


r/Gridsome • • Jun 06 '20

Adding commenting system to your app

Thumbnail self.vuejs
1 Upvotes

r/Gridsome • • Dec 22 '20

Gridsome Newbie Question

2 Upvotes

Hey guys,

I’m a Gridsome newbie and was planning to use it for my next project.

I have a few questions about if it fits my needs.

I want to build a project where the client can enter a username and call an external api to get data about this user which I want to display. Then it should generate a static site with this data with the username as the path.

This should be possible right? My other concern is once the page is created I want it to update the data if the username has new data. I know this is probably impossible to do but maybe there’s a way to scrape the data again with the first request to it of the day. So that this username gets updated every 24h.

Thanks for your help guys!


r/Gridsome • • Aug 20 '20

Gridsome Website with Firebase and Github Page Hosting

3 Upvotes

Hey guys,

I've written a blog about Gridsome and hosting it into Firebase & Github Pages.

The link is here: https://eliakorkmaz.github.io/building-a-blog-with-gridsome-and-publish-it-to-firebase-github-pages/

I would like to get some feedback if it's possible. Maybe there can be any fixable things or something.

Thanks in advance.


r/Gridsome • • Sep 14 '20

Gridsome + Wordpress - Do you use it? Is it worthwhile?

5 Upvotes

Hi all,

I've been experimenting with Gridsome, and the 'Gridsome WordPress and Bootstrap starter'

To start, I noticed Gridsome has an issue where 'gridsome develop' does not show errors.

I struggled to identify why pages from WP weren't working, until I ran 'gridsome build' which throws the error, which helped me fixed it (if anyone has that issue, feel free to ask).

I previously tried Gatsby. Much easier to understand, much better documentation, much better templating approach. Bbut I do not seem to get on with the way React works. Vue seems a better for for me.

The point of this post is, I am not looking to master this. As soon as it's set up, I want to pass the project on to a developer with more of these specific skills. However, I do want to understand the basics though (I'm a php dev).

But before I dive in further, I am interested to see how popular Gridsome + Wordpress is. It does not seem to be that popular (nor does Gridsome generall). Given the poor documentation, which seems old-fashioned (bits and pieces presented with too many assumptions made about what reader knows already), I wonder how many devs really use this. Might also explain Gatsby's popularity.

It is possible (though not guaranteed) that we might ask whoever comments, who has the skills, to be that new developer.

Thanks for getting this far!


r/Gridsome • • Apr 23 '21

No auto-generated route names for pages

2 Upvotes

I’m on a fresh install of Gridsome and noticed that route names are not being auto-generated for pages. When I print $route.name in my template or this.$route.name anywhere else for each page, the only route that has a name is index.vue with the name home. Error pages have a route name of *.

Is anyone else experiencing this? This becomes a problem when I use Google Tag Manager because it relies on route names (unless I push events manually).


r/Gridsome • • Oct 24 '20

I wrote a little guide to setting up Gridsome with a markdown blog (supporting tag pages)

Thumbnail webdevetc.com
6 Upvotes

r/Gridsome • • Jun 22 '20

Gridsome and Wordpress.com

3 Upvotes

is it possible to use gridsome and wordpress.com or does it have to be wordpress.org? I can't seem to find an answer.


r/Gridsome • • Sep 30 '20

Can you show random content on gridsome?

1 Upvotes

Hi I am evaluating a few static site generators and comparing them. Is it possible to add random content to gridsome? Something that is the same as "Select * from products order by rand() limit 5", but of course in whatever gridsome uses.


r/Gridsome • • Dec 07 '20

Building a Jamstack Food Ordering App with Strapi, Gridsome & Snipcart

Thumbnail
strapi.io
1 Upvotes

r/Gridsome • • Nov 16 '20

Stubbing gridsome components / directives

1 Upvotes

Is this the best way to stub out internal components when testing? (jest)

const GLinkMock = {
  template: '<a href="test"/>',
};

const wrapper = mount(Testimonals, {
      stubs: {
       GLink: GLinkMock
      },

Thanks


r/Gridsome • • May 30 '20

Plugin to source data from hashnode devblogs

1 Upvotes

Hey folks,

I've built a gridsome plugin to source your blog posts from devblogs by hashnode (https://hashnode.com/devblog).

Link - https://github.com/nishantwrp/gridsome-source-hashnode-devblog

Please do take a look. Any feedback is appreciated.


r/Gridsome • • Feb 10 '21

Any luck having gridsome work with DatoCMS i didn't have any documentation whatsoever

1 Upvotes

r/Gridsome • • Jul 01 '20

Form posts with gridsome

4 Upvotes

Hi,

I understand that gridsome renders static markup and data at build time (even if sourced from an API) but could I use vue to post a form to an API / function? or do I need to use a third party integration? Thanks


r/Gridsome • • Mar 03 '21

How best to build random Vue plugins into a Gridsome project if they invoke `window` or do client-side DOM modification?

3 Upvotes

I'm trying to use vue-easy-lightbox in Gridsome app. gridsome build process fails with Could not generate HTML for "/my-page/": ReferenceError: window is not defined.

After some reading it's a totally expected error due to plugin not supporting SSR. But the docs' workaround for this does not seem to work for me.

I found a couple of work-arounds in comments here and there—most of them fragments. None have worked.

Currently trying to wrap the external component in <ClientOnly> as shown in the Add External Scripts / Without SSR support docs. But it's still missing something since it fails with the same error.

So, how to do this?

Simplified code with documentation workaround:

main.js

import DefaultLayout from '~/layouts/Default.vue'
import VueEasyLightbox from 'vue-easy-lightbox'

export default function (Vue) {
  Vue.component('Layout', DefaultLayout),
  Vue.component('VueEasyLightbox', VueEasyLightbox),
  Vue.use(VueEasyLightbox)
}

MyPage.vue

<template>
  <Layout>
    <ClientOnly>
      <VueEasyLightbox>
       ... 
      </VueEasyLightbox>
    </ClientOnly>
  </Layout>
</template>

<script>
export default {
  components: {
    VueEasyLightbox: () => import('vue-easy-lightbox')
      .then(m => m.VueEasyLightbox)
      .catch() 
    // With this code block, the component doesn't 
    // render on the development server either
  }
}
</script>

r/Gridsome • • Nov 13 '20

WordPress Dynamic Root Path

2 Upvotes

I am looking at converting a current WordPress site into a Gridsome static gen site.

The question / issue that I run into is that WP allows you to create posts with dynamic root level paths.

https://mysite.com/my-awesome-post

And there are hundreds of articles like this.

My understanding of collections and pages would indicate that I would not be able to do that.

I would need to place them into a collection like post first.

https://mysite.com/post/my-awesome-post

Is that correct or is it possible to supply a path argument on the Index.vue page and pull in the post via the page query?

I would really like to avoid 200 different 301 redirects.


r/Gridsome • • May 05 '20

Struggles with g-image

2 Upvotes

So I’ve been building a couple of sites in gridsome and really been enjoying it, so I decided to take on a larger project and rebuild one of my bigger sites with it. The struggle revolves around g-image. I’m using WordPress headless and want to pull in images from acf galleries and have them optimized by g-image. This has been super challenging with remote images. Probably Over 7 k images at least. Am I better to pair a Cdn with gridsome instead?


r/Gridsome • • Sep 23 '20

Gridsome + JS libraries? How to implement?

2 Upvotes

Hey,

I'm building a portfolio for the first time using gridsome. I've been looking around online for people using different libraries with gridsome but I really couldn't find anything... are only the plugin features available or how do you implement a custom library like three.js?

Thanks!


r/Gridsome • • Nov 23 '20

The most famous companies that have already chosen Vue.js

Thumbnail
medium.com
2 Upvotes