Customize page field snippets for a page layout

Using the design manager to create some custom page layouts which are associated with a custom content type that has some metadata. The pages in my library have extra information that we are using along with managed navigation and search faceting.

I’ve used the design manager to create snippets for the .html version of the page layout. For example I’ve created a section for Show only in Edit Mode and then a snippet for my managed metadata Topic. This allows the page editors/creators to assign the metadata while editing the page — saves them having to open the properties panel. This works great and only shows the metadata tagging control while the page is in edit mode.

But I also want to show the tags to the end user — just in a different place.

So I created a different Show only in Regular Mode section and put another Topic snippet in that part. And that works.

But some of our pages belong to two topics. In that case I don’t want to use the default display of

Topic 1; Topic 2 

Is there a way to customize how that is shown?

In looking at the snipped customizer I see the following attributes that seem promising

  • AlternateTemplate
  • CustomTemplate
  • DisplayTemplate
  • Template

I tried searching for information about how one might use those or even if they do what I hope. But I couldn’t find anything because there are so many combinations of “SharePoint pagelayout snippet template” and combinations thereof.

I’m not sure what kind of values to put in those attributes and can’t find any documention, so I tried putting a value in Custom template and got an error:

Cannot create an object of type ‘System.Web.UI.ITemplate’ from its string representation ‘MyCustomTemplate’ for the ‘CustomTemplate’ property.

Similar error for the other attributes.

Is there a way to customize how snippets display their content? How do I do that?

Add Rich Snippets Magento 2

I have the following code, which I have appended to the opengraph/general.phtml file in Magento 2.

I am hoping this will add the rich snippet data required by Google, but I am receiving an error (blank page).

Existing Code of opengraph/general.phtml

    <?php /**  * Copyright © Magento, Inc. All rights reserved.  * See COPYING.txt for license details.  */  // @codingStandardsIgnoreFile  /** @var $  block \Magento\Catalog\Block\Product\View */ ?>  <meta property="og:type" content="product" /> <meta property="og:title" content="<?= $  block->escapeHtmlAttr($  block->stripTags($  block->getProduct()->getName())) ?>" /> <meta property="og:image" content="<?= $  block->escapeUrl($  block->getImage($  block->getProduct(), 'product_base_image')->getImageUrl()) ?>" /> <meta property="og:description" content="<?= $  block->escapeHtmlAttr($  block->stripTags($  block->getProduct()->getShortDescription())) ?>" /> <meta property="og:url" content="<?= $  block->escapeUrl($  block->getProduct()->getProductUrl()) ?>" /> <?php if ($  priceAmount = $  block->getProduct()->getFinalPrice()):?>     <meta property="product:price:amount" content="<?= /* @escapeNotVerified */ $  priceAmount ?>"/>     <?= $  block->getChildHtml('meta.currency') ?> <?php endif;?>  <?php /** Rich Snippet Code */ ?>      <?php $  _product = $  this->getProduct(); $  _brand = $  this->getBrand($  _product); $  _sku = $  this->getSku($  _product);  ?>  <script type="application/ld+json">     {         "@context": "https://schema.org/",         "@type": "Product",         "name": "<?php /* @escapeNotVerified */ echo $  block->escapeQuote($  block->stripTags($  _product->getName())); ?>",         "image": "<?php /* @escapeNotVerified */ echo $  block->stripTags($  block->getImage($  _product, 'product_base_image')->getImageUrl()); ?>",         "description": "<?php /* @escapeNotVerified */ echo $  block->escapeQuote($  block->stripTags($  block->getDescription($  _product))); ?>", <?php if (strlen(trim($  _brand))): ?>         "brand": {             "@type": "Thing",             "name": "<?php echo $  block->stripTags($  _brand); ?>"         }, <?php endif; ?>         "offers": {             "@type": "Offer",             "priceCurrency": "<?php echo $  block->getCurrencyCode() ?>",             "url": "<?php echo $  block->stripTags($  block->getCurrentUrl($  _product)); ?>", <?php if ($  _product->isAvailable()): ?>             "availability": "https://schema.org/InStock",  <?php else : ?>             "availability": "https://schema.org/OutOfStock", <?php endif; ?>             "price": "<?php echo $  this->getPrice(); ?>",             "priceValidUntil": "<?php echo $  _product->getSpecialToDate(); ?>"         }     } </script> 

Can anyone please advise a solution?

How to let VSCode snippets suggest angularjs directives only as atributes?

My snippets are suggesting angularjs directives everywhere, not only in html tags as attributes.

I have this snippet now.

{     "ng-app": {         "prefix": "data-ng-app",         "body": "data-ng-app=\"app\"$  0"     },     "ng-bind": {         "prefix": "data-ng-bind",         "body": "data-ng-bind=\"$  1\"$  0"     },     "ng-bind-html": {         "prefix": "data-ng-bind-html",         "body": "data-ng-bind-html=\"$  1\"$  0"     },     "ng-bind-template": {         "prefix": "data-ng-bind-template",         "body": "data-ng-bind-template=\"$  1\"$  0"     },     "ng-controller": {         "prefix": "data-ng-controller",         "body": "data-ng-controller=\"$  1\"$  0"     },     "ng-model": {         "prefix": "data-ng-model",         "body": "data-ng-model=\"$  1\"$  0"     },     "ng-view": {         "prefix": "data-ng-view",         "body": "data-ng-view=\"\"$  0"     } } 

Expected: suggest only if cursor is at this position

“|” = cursor

Current: Suggest everywhere

Rich snippets code and site name in search engine results?

Where do i add reviews code and site name in search engine results code for my website. If i add to home page every one will be able to see.I saw there are some websites published with reviews but the code not in homepage. Suggest me how to do..i need help urgently..Thanks in Advance.. and after adding how long will it take it is to be published in search engine results…Please let me know…

Code Snippets plugin by Shea

I just downloaded Code Snippets for my WordPress website that looks really promising for a newbie like me. I’m getting ready to create some snippets and I’m concerned about any potential errors causing my site to shut down (I just had that happen yesterday when I tried to enter snippets in my Highend Child theme. I needed to be rescued by my webhost customer service).

I see in the FAQ on this page, https://wordpress.org/plugins/code-snippets/#description, a person asked about this potential. Shea said it’s possible to activate safe mode by adding the following line to your wp-config.php file, just before the line that reads /* That’s all, stop editing! Happy blogging. */:

define(‘CODE_SNIPPETS_SAFE_MODE’, true);

Trouble is I can’t find where wp-config.php file is. I did find under Appearance-Edit Themes-Theme files there is a plain config.php file but I couldn’t find the line that reads as above to know where to safely put this line.

Just trying to play it safe before I start creating code snippets and possibly break my site! Thanks