Skip to content

Context for pages not available during build #434

Closed
@xyNNN

Description

@xyNNN

Description

When I try to run gridsome build the manually created static pages have no access to the defined "context".

Steps to reproduce

        createPage({
            path: "/Kontakt",
            component: "./src/pages/Contact.vue",
            context: {
                title: "Kontakt",
                content: "Something",
            }
        });
<template>
    <Layout>
        <div v-html="$context.content"></div>
    </Layout>
</template>

<script>
export default {
    metaInfo() {
        return {
            title: this.$context.title
        };
    }
};
</script>

<style lang="scss" scoped></style>

Expected result

Should render as in the development mode.

Actual result

Failed to render /kontakt
TypeError: Cannot read property 'content' of null

Environment


Libs:
- gridsome version: 0.6.1
- @gridsome/cli version: 0.0.8
 
For Tooling issues:
- Node version: 11.15.0
- Platform:  Mac

Metadata

Metadata

Assignees

Labels

questionUnsure if I am doing it right

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions