# Generate social posts from your content https://www.sanity.io/learn/course/seo-optimization/ai-generate-social-posts-from-your-content.md Speed up ideation of social media posts. And as a result, boost your SEO from sharing your content to a wider audience across different social platforms. 1. This lesson uses features only available in paid plans. If you started a new project for this course, you can test these features during the free trial period. You can also start a new free project at any time. Summarizing existing content and making it more useful in different forms is one of the best features of AI tooling. Sanity AI Assist makes it possible for authors to automatically generate new content, using existing fields along with prompts that they can save and share. In this lesson you'll use Sanity AI Assist to generate text to post on social networks while sharing a link to the content. 1. Read more about [Sanity AI Assist](https://www.sanity.io/docs/install-and-configure-sanity-ai-assist) in the documentation ## Create new schema types First you'll need new fields to write content to. Just like you made a new custom object schema type for SEO fields, create another for social networks. In the example below we've chosen only LinkedIn and X (formerly known as Twitter) for now, feel free to include any of the countless others. 1. **Create** a new `social` object schema type ```typescript:src/sanity/schemaTypes/socialType.ts import { defineField, defineType } from "sanity"; export const socialType = defineType({ name: "social", title: "Social", type: "object", fields: [ defineField({ name: "linkedIn", title: "LinkedIn", type: "text", rows: 3, }), defineField({ name: "x", description: "Formerly known as Twitter", type: "text", rows: 2, }), ], }); ``` Don't forget to register this type to your Sanity Studio schema types ```typescript:src/sanity/schemaTypes/index.ts // ...all other imports import { socialType } from "./socialType"; export const schema: { types: SchemaTypeDefinition[] } = { types: [ // ...all other types socialType, ], }; ``` 1. **Update** your `page` and `post` schema types to include the `social` field. ```typescript:src/sanity/schemaTypes/pageType.ts export const pageType = defineType({ // ...all other settings fields: [ // ...all other fields defineField({ name: "social", type: "social", }), ], }); ``` ## Install Sanity AI Assist To automatically generate content for these fields, you'll now install and configure the Sanity AI assistant. 1. **Run** the following in your terminal ```sh:Terminal npm install @sanity/assist ``` 1. **Update** your Sanity Studio config file to include the `assist` plugin ```typescript:sanity.config.ts // ...all other imports import { assist } from "@sanity/assist"; export default defineConfig({ // ...all other config plugins: [ // ...all other plugins assist(), ], }); ``` With this installed you can create a prompt to help Sanity AI Assist generate content from your existing fields. Sanity AI Assist works at both field level and document level, however, for this example, you will be using the document level. Look at the top right of the Studio with any document open and you should see a sparkly new icon. ![Sanity Studio document editor with the AI Assist pane open](https://cdn.sanity.io/images/3do82whm/next/dd14f510b2c470a2f0b8889136805128c7efe1bc-2784x1628.png) The first time you click this button you may be asked to Enable AI Assist 1. Click **Enable AI Assist** You can see there are currently no instructions. 1. Click **Add item** to create your first instruction. What we want AI Assist to do is to summarize the main body of the document You're going to create a new prompt, use the example below for guidance. Where you see the boxes like `[Title]`, replace these with references to the fields in your document. Make sure the **Allowed fields** is set to only write to the **Social** field object. 1. **Create** your new Instruction and run it ```text Take the content from [title] and [body] to generate text that will encourage people to click the link and find out more when this content is shared on social networks. ``` ![Sanity Studio showing an AI Assist prompt being run](https://cdn.sanity.io/images/3do82whm/next/494aca1c1959bac7585f64998c585465cfd3ac5e-2784x1628.png) 1. Writing prompts for AI is a bit of an art form! Take a look at the [instructions cheat sheet](https://www.sanity.io/docs/ai-assist-cheat-sheet) in the documentation for inspiration. ### Posting to social networks In this lesson you're only using Sanity to **generate** text for posting to social networks. So for now your authors would need to copy and paste them from Sanity. There are a variety of third-party tools available to automate this process. Please use the feedback form below to let us know if you have preferred ways to automate posting to social networks. ### Adapt to your tone of voice By default, AI-generated copy can be generic. Consider adding some **AI context** documents (now visible in your Studio structure) to inform your preferred writing style and tone of voice. You can then add this context to your instruction, so that copy generated in future will be consistently informed. In the following lesson, you'll create a dynamic sitemap that automatically updates when content changes. Helping search engines discover and index your content more effectively.