Modify schema.js and add linkedin to Structured Data

Hi together,

I am facing the following challenge: For all the authors on my website I would like to extend the structured data with linkedin.

Therefore the JSON-LD for authors should look like:

    "@context": "",
    "@type": "Person",
    "sameAs": [
    "name": "author name",
    "url": "",
    "image": {
        "@type": "ImageObject",
        "url": "",
        "width": 2240,
        "height": 1260
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": ""
    "description": "Author description."

However, achieving this goal is not as easy as I thought.

So far, I have done the following steps:

Step 1:

I have opened /core/frontend/meta/schema.js and modified the trimSameAs(data, context) function to the following:

function trimSameAs(data, context) {
    const sameAs = [];

    if (context === 'post' || context === 'page') {
        if (data[context] {
        if (data[context].primary_author.facebook) {
        if (data[context].primary_author.twitter) {
        if (data[context].primary_author.linkedin) {
    } else if (context === 'author') {
        if ( {
        if ( {
        if ( {
        if ( {

    return sameAs;

Step 2:

I have downloaded the .json-file of my database. For each author I tried to add the following property:

"twitter": "@example",
"linkedin": "url-to-linkedin"

After doing the modifications, I uploaded the .json-file and realized afterwards (when downloading it again) that the key-value property was deleted.

Step 3:

I concluded that the property was deleted, since there was no approriate definition made in /core/server/data/schema/schema.js. Afterwards, I opened the file and and edited the users-property to get the following result:

website: {type: 'string', maxlength: 2000, nullable: true, validations: {isEmptyOrURL: true}},
        location: {type: 'text', maxlength: 65535, nullable: true, validations: {isLength: {max: 150}}},
        facebook: {type: 'string', maxlength: 2000, nullable: true},
        twitter: {type: 'string', maxlength: 2000, nullable: true},
        linkedin: {type: 'string', maxlength: 2000, nullable: true},

After restarting ghost, I ended up with a 503-error.

Would be extremely thankful if you could give me hints and ideas of where I should look next :slight_smile:

The schema file is the golden file that’s used to initialize your database, or perform certain validations against data before it’s added to the database. If you’re trying to change the database, you have to write a migration to do that, make sure the migration is correct, and make sure that it can be undone.

On top of that, you have to add support for linkedin in the exporter, API, admin interface, etc. and keep those changes in sync with Ghost.

If you’re able to I’d suggest using a different field as the linkedin reference and override your schema generator to support it