Skip to content

davidfateh/ctfl-open-graph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Open Graph Preview

The Open Graph Preview App for Contentful provides a visualization of an open graph content type. This app is mainly used for demonstration purposes to show how we can link together app locations within the App Framework to provide a cohesive experience for users.

This app extends a short text field, uses data from a reference field, and combines data to visualize it in a page location.

The field:

Open Graph Content Type Field

The page location:

Open Graph Page Location

Understanding how multiple locations communicate with each other

Making a network call via the SDK inside a change event

We make a network call inside of the onValueChange of another field in src/components/Field.tsx:39

Making multiple network calls on the page location

In order to collate data from reference, we make two network calls in src/components/Page.tsx:98. This is done in a Promise.all and once resolved, will be used by the render method.

Using the URL on a page location to inject data

The Button component in the field to preview an Open Graph entry uses sdk.navigator to open a page location while injecting the path. In our case, we inject the entry ID on src/components/Field.tsx:56 and read that information to make more network calls in the page location at src/components/Page.tsx:88 by using sdk.parameters.invocation.path.

Developing and extending this project

This project was bootstrapped with Create Contentful App.

Available Scripts

In the project directory, you can run:

npm start

Creates or updates your app definition in contentful, and runs the app in development mode. Open your app to view it in the browser.

The page will reload if you make edits. You will also see any lint errors in the console.

npm run build

Builds the app for production to the build folder. It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes. Your app is ready to be deployed!

Libraries to use

To make your app look and feel like Contentful use the following libraries:

Learn More

Read more and check out the video on how to use the CLI.

Create Contentful App uses Create React App. You can learn more in the Create React App documentation and how to further customize your app.

About

Multi location app for Open Graph

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published