Jump to content
psy

JSON+LD Schema module

Recommended Posts

This module helps you dynamically create schemas for improved SEO & SERP listings from within your templates. Each schema can be configured to meet your requirements. You can even add your own ProcessWire schema classes to the module.

Read about the module on  github: https://github.com/clipmagic/MarkupJsonLDSchema

Download from github: https://github.com/clipmagic/MarkupJsonLDSchema/zipball/master

Download from ProcessWire modules: http://modules.processwire.com/modules/markup-json-ldschema/

  • Like 14

Share this post


Link to post
Share on other sites

Am I missing something? Where is that module? Do you have a link? Maybe I'm confused by the new forum changes, but I don't see an attachment either...

Share this post


Link to post
Share on other sites

Most of the time people do not only submit the module to the modules directory, but also link to either the module's page in the directory or the github repo (sometimes both) from their forum posts as well. Especially as it seems like your module is by not not approved in the module's directory nobody but you can see it there.

Share this post


Link to post
Share on other sites

OK. Still learning. Thanks.

Submitted module via github and had to open a forum topic as part of that process. Hopefully sorted now.

Let me know if I need to do more to make the module available.

 

Share this post


Link to post
Share on other sites

Links added and closing tags removed.

I updated the version # to 0.0.3 but it is still showing 0.0.2 in the modules directory?

Thank you all for your help. Much appreciated. :)

Share this post


Link to post
Share on other sites

The modules directory visits github once a day. To force it to refresh, just edit the module in the directory, but don't do anything and just save. That forces the crawler to go back to github and voila, you got it updated :)

 

Congrats on your new module btw ^-^

  • Like 2

Share this post


Link to post
Share on other sites

Have not checked out the module yet, but seems like a very nice addition. The JSON+LD Schema is really something Google will be using a lot in the future. Mark my words!

  • Like 1

Share this post


Link to post
Share on other sites

This is a very nice module,  but when I try to validate a LocalBusiness schema using Google Search structured data tester, it don't validate. I got some error message like: Google doesn't recognise property streetAddress for an object of the type LocalBusiness. Same for addressLocality , addressRegion, .... Got the same problem when I try to valicate an article. Thank's for your help!

Share this post


Link to post
Share on other sites
11 hours ago, Pino said:

This is a very nice module,  but when I try to validate a LocalBusiness schema using Google Search structured data tester, it don't validate. I got some error message like: Google doesn't recognise property streetAddress for an object of the type LocalBusiness. Same for addressLocality , addressRegion, .... Got the same problem when I try to valicate an article. Thank's for your help!

Oh, yes you're correct. According to the reference, addresses are associated with Organization, not localBusiness. I will fix and update the module.

https://developers.google.com/schemas/reference/types/Place

https://developers.google.com/schemas/reference/types/LocalBusiness

Thanks for bringing this to my attention.

 

  • Like 1

Share this post


Link to post
Share on other sites

@OllieMackJames

Glad you like it :)

There are way too many schemas for me to include in the basic module. I chose what I thought would be the most useful. However you have a couple of options:

1. Use the custom schema option, eg:

$jsonld = $modules->get("MarkupJsonLDSchema");
$options = array();
$options["@type"] = "VideoObject";
$options["custom"] = array (
  "actor" => "Barney Rubble",
  "caption" => "What an actor!",
  ...
);
?>
<script type="application/ld+json">
  <?php $jsonld->render('Custom',$options); ?>
</script>

OR

2. Write your own schema and add it to the site/modules/MarkupJsonLDSchema/schemas/ directory. See the other schemas in there and their naming conventions as examples, and feel free to include your video schema code in this topic to share with others.


BTW, the link http://jsonld.com/video/ leads to a 404 Error. A much better resource is http://schema.org/VideoObject.

Hope this helps
psy
  
 

  • Like 1

Share this post


Link to post
Share on other sites

Hi @psy,

Thanks for sharing your module!  I've been trying out your module and I'm aware that I don't have to use the default schemas and can use overrides, but I have a few questions:

Share this post


Link to post
Share on other sites

@gmclelland Thanks for the feedback . This was my first module, dipping my toe in so to speak. I found the whole schema thing confusing and the module could definitely do with an update. Have taken your suggestions on board - plus a few other things I've learnt about json-ld schemas in the interim - and hope to release an update in the new year

Share this post


Link to post
Share on other sites

Good to hear psy!  Looking forward to trying it.  I just started learning about JSON-LD, and your module and readme.txt with the links helped point me in the right direction.

19 hours ago, psy said:

I found the whole schema thing confusing

I've found it very confusing as well.  The JSON-LD and Google documentation doesn't exactly say when or what pages you should use Website schema vs Webpage.  Does the Organization markup go on every page, or just the homepage of the website? etc..etc...

  • Like 1

Share this post


Link to post
Share on other sites

I keep getting undefined index 'image'

Tried several ways to get rid of this error.

What is recommended/correct way to add the code for the images in the template?

Share this post


Link to post
Share on other sites

Hello Psy,

I currently have this and it looks like images are outputted

I must have made a stupid mistake somewhere. On another site I got it working in one time.

 

    $jsonld = $modules->get('MarkupJsonLDSchema'); ?>
    <script type="application/ld+json">
<?php
        switch ($page->template) {

            case 'product':

                $options = array(
                    'logo' => $pages->get(1)->logo->size(200, 200),
                    'image' => $page->images->first()->size(200, 200)
                );
                echo $jsonld->render('Product', $options);
                //  echo $jsonld->render('BreadcrumbList');
                break;
            case 'categorieen':
                $options_c = array(
                    'logo' => $pages->get(1)->logo->size(200, 200),
                    'description' => $page->summary,
                    'image' => $pages->get(1092)->images->first()->size(200, 200)
                );
                echo $jsonld->render('Product', $options_c);
                echo $jsonld->render('BreadcrumbList');
                break;
            default:
                $options = array(
                    'logo' => $pages->get(1)->logo->size(200, 200),
                    'image' => $page->images->first()->size(200, 200)
                );
                echo $jsonld->render('WebPage', $options);
                echo $jsonld->render('LocalBusiness');
                echo $jsonld->render('BreadcrumbList');
                break;
        }
        ?>
    
    </script>

Share this post


Link to post
Share on other sites

Thanks for sharing @webhoes

Glad it's working for you.

Schema's are confusing and you can always write your own and add them to the schema dir of the module (and share here of course!)

One thing you may want to check... you're outputting several schemas within one <script> tag... maybe you need to enclose them in brackets, eg:

<script>[
    .... your output schemas ....
]<script>

to show multiple json arrays within one script tag. No expert here and would appreciate comments/recommendations from others.

Cheers

psy

 

 

Share this post


Link to post
Share on other sites

I don't understand them either. Was just working based of the sample's. I googled and it does not seem to matter if you use one block or more. I did quick and dirty fix... looking like this. Note I always have atleast 2 schemes and therefor kinda hardcoded the brackets. There is also a ',' between 2 schemes.

  <?php
    $jsonld = $modules->get('MarkupJsonLDSchema'); ?>
    <script type="application/ld+json">[
<?php
        switch ($page->template) {

            case 'product':

                $options = array(
                    'logo' => $pages->get(1)->logo->size(200, 200),
                    'image' => $page->images->first()->size(200, 200)
                );
                echo $jsonld->render('Product', $options) . ",";
                echo $jsonld->render('BreadcrumbList');
                break;
            case 'categorieen':
                $options_c = array(
                    'logo' => $pages->get(1)->logo->size(200, 200),
                    'description' => $page->summary,
                    'image' => $pages->get(1092)->images->first()->size(200, 200)
                );
                echo $jsonld->render('Product', $options_c) . ",";
                echo $jsonld->render('BreadcrumbList');
                break;
            default:
                $options = array(
                    'logo' => $pages->get(1)->logo->size(200, 200),
                    'image' => $page->images->first()->size(200, 200)
                );
                echo $jsonld->render('WebPage', $options) . ",";
                echo $jsonld->render('LocalBusiness') . ",";
                echo $jsonld->render('BreadcrumbList');
                break;
        }
        ?>

    ]</script>
  • Like 3

Share this post


Link to post
Share on other sites

BTW, if you use width() you get a cached image with name-200-0.jp. That means it has no height and therefor is not really an image. Using size() gets a correct image.

 

 

  • Like 2

Share this post


Link to post
Share on other sites

I was reading a thread about Structured Data, is it possible to use this module to generate the AggregateRating? 

See MarcoPLY example. Thank you.

 

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
    • By ukyo
      FieldtypeFontIconPicker
      Supported Icon Libraries
      FontAwesome 4.7.0 Uikit 3.0.34 IonicIcons 2.0.1 Cahangelog
      NOTE: Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix".
      Module will search site/modules/**/configs/IconPicker.*.php and site/templates/IconPicker.*.php paths for FieldtypeFontIconPicker config files.
      All config files need to return a PHP ARRAY like examples.
      Example config file : create your own icon set.
      File location is site/configs/IconPicker.example.php
      <?php namespace ProcessWire; /** * IconPicker : Custom Icons */ return [ "name" => "my-custom-icons", "title" => "My Custom Icon Set", "version" => "1.0.0", "styles" => array( wire("config")->urls->templates . "dist/css/my-custom-icons.css" ), "scripts" => array( wire("config")->urls->templates . "dist/js/my-custom-icons.js" ), "categorized" => true, "attributes" => array(), "icons" => array( "brand-icons" => array( "title" => "Brand Icons", "icons" => array( "google", "facebook", "twitter", "instagram" ) ), "flag-icons" => array( "title" => "Flag Icons", "icons" => array( "tr", "gb", "us", "it", "de", "nl", "fr" ) ) ) ]; Example config file : use existing and extend it.
      File location is site/configs/IconPicker.altivebir.php
      <?php namespace ProcessWire; /** * IconPicker : Existing & Extend */ $resource = include wire("config")->paths->siteModules . "FieldtypeFontIconPicker/configs/IconPicker.uikit.php"; $url = wire("config")->urls->templates . "dist"; $resource["scripts"] = array_merge($resource["scripts"], ["{$url}/js/Altivebir.Icon.min.js"]); $resource["icons"]["flag-icons"] = [ "title" => "Flag Icons", "icons" => array("tr", "en", "fr", "us", "it", "de") ]; $resource["icons"]["brand-icons"]["icons"] = array_merge($resource["icons"]["brand-icons"]["icons"], array( "altivebir" )); return $resource; After you add your custom config file, you will see your config file on library select box. Library Title (Location Folder Name).

      If your library categorized and if you have categorized icons set like uikit and fontawesome libraries, you will have category limitation options per icon field or leave it empty for allow all categories (default).

      Example : output
      if ($icon = $page->get("iconField")) { echo "<i class='prefix-{$icon}' />"; } MarkupFontIconPicker Usage
      // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Theme support

      Search support

      Category support

       
×
×
  • Create New...