Skip to content
Discussion options

You must be logged in to vote

Hi Nafuna,

The code example from the ghost docs is using an outdated convention of loading data from Svelte's beta days.
Declaring the load function in the svelte file is no longer supported.

You'll have to utilise a +page.server.ts file to load your data into a +page.svelte page file as explained in the link below.
https://kit.svelte.dev/docs/load

The solution should look something like the two file examples below:

// src/routes/+page.server.ts
import { GhostContentAPI } from '@tryghost/content-api';

const GHOST_URL = 'http://blog.nafuna.tv';
const GHOST_KEY = '87f6096411ae42f96df2615620';
const GHOST_VERSION = 'v5';

export async function load() {
  const api = GhostContentAPI({
      url

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
3 replies
@NafunaAfrica
Comment options

@NafunaAfrica
Comment options

@theSalted
Comment options

Answer selected by eltigerchino
Comment options

You must be logged in to vote
10 replies
@NafunaAfrica
Comment options

@eltigerchino
Comment options

@NafunaAfrica
Comment options

@eltigerchino
Comment options

@NafunaAfrica
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants