Документы Gridsome немного понятнее, чем версия npm, но вам нужно сгенерировать закрытый ключ Firebase Admin SDK и загрузить весь файл в приложение Gridsome и импортировать его в gridsome.config.js в виде модуля, назвать его как угодновы хотите для параметров> учетные данные: поле обязательна, как показано ниже.
Сначала вам понадобится плагин Firestore
$ yarn add gridsome-source-firestore
Затем в gridsome.config.js
const { db } = require('gridsome-source-firestore')
module.exports = {
plugins: [
{
use: 'gridsome-source-firestore',
options: {
credentials: require('./my-project-firebase-adminsdk-qw2123.json'), //
Replace with your credentials file you downloaded.
debug: true, // Default false, should be true to enable live data updates
ignoreImages: false, // Default false
imageDirectory: 'fg_images', // Default /fg_images
collections: [
{
ref: (db) => {
return db.collection('news')
},
slug: (doc, slugify) => {
return `/news/${slugify(doc.data.title)}`
},
children: [
{
ref: (db, parentDoc) => {
return parentDoc.ref.collection('posts')
},
slug: (doc, slugify) => {
return `/${slugify(doc.data.title)}`
},
}
]
}
]
}
}
]
}
Возможно, вам придется изменить «posts» на «content» в зависимости от структуры вашей БД и изменить соответствующие запросы страниц, есть некоторые примеры и другая полезная информация о настройке в этом стартовом файле Gridsome Firestore на Github https://github.com/u12206050/gridsome-firestore-starter.git