question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Customizable meta-fields?

See original GitHub issue

The current verison of Piranha CMS (2.x) has fields for the meta tags keywords & description. Maybe it would be nice to be able to configurate the meta fields that should be available and have them as a dynamic collection. This could for example configurated like this:

"SEO" : [
  {
    "Id" : "keywords",
    "Title": "Keywords",
    "Mandatory": false,
    "Max": 128
  },
  {
    "Id": "description",
    "Title": "Description",
    "Mandatory": false,
    "Max": 255
  }
]

These fields should also be available when manipulating the model from code, for example:

var post = api.Posts.GetById(...);

post.SEO["keywords"] = "Piranha,CMS,Blog,.NET,DotNetCore,MVC";
post.SEO["description"] = "This is the description for the post";

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tidyuicommented, Dec 12, 2016

All of this would actually be doable right now with the current page type support, but with some nicer structure like this:

using Piranha.Extend.Fields;
using Piranha.Models;

public class SEO
{
  [Field(Title = "Change Freq")]
  public StringField SearchEngineChangeFreq { get; set; }
  [Field(Title = "Priority")]
  public StringField SearchEnginePriority { get; set; }
}

public abstract class MyPageBase<T> : Page<T> where T : Page<T>
{
  [Region]
  public SEO SEO { get; set; }
}

The only thing missing is the enum support which I like and will add before the first release!

/Håkan

0reactions
LucGossocommented, Dec 12, 2016

Regarding SEO on applicationlevel: here is my input from experience:

In Episerver CMS it’s common to inherit an abstract BaseSearchPage or ISearchPage. For being able to build a proper sitemap.xml as Google wants it, you’ll need these properties:

If you don’t inherit from this class, you’ll output no-index in metatag and does’nt display it in sitemap.xml.

`{ public abstract class BaseSearchIndexable : BasePageModel { [Display(Name = “Exclude from search indexing”, Description = “”, Order = 10000, GroupName = “SEO”)] public override bool ExcludeFromSearch { get; set; }

    [CultureSpecific(true)]
    [Display(Name = "Search Engine Title",
        Description = "",
        Order = 10001,
        GroupName = "SEO")]
    public override string SearchEngineTitle { get; set; }

    [CultureSpecific(true)]
    [Display(Name = "Search engine description",
        Description = "",
        Order = 10002,
        GroupName = "SEO")]
    [UIHint("textarea")]
   public virtual string SearchEngineDescription { get; set; }
    
    [UIHint("AppSettings")]
    [Display(Name = "Search Engine ChangeFreq",
        Description = "",
        Order = 10003,
        GroupName = "SEO")]
    public override string SearchEngineChangeFreq { get; set; }

    [UIHint("AppSettings")]
    [Display(Name = "Search Engine Priority",
        Description = "",
        Order = 10004,
        GroupName = "SEO")]
    public override string SearchEnginePriority { get; set; }

     [CultureSpecific]
    [Display(Name = "Search engine keywords",
        Description = "",
        Order = 10010,
        GroupName = "SEO")]
    public virtual string MetaKeywords { get; set; }

//extra bonusproperty if you somehow have a custom searchengine [CultureSpecific] [Display(Name = “Include as Best bet”, Description = “Best bets are custom hits that you can create and display above the organic results list. They are perfect for giving users quick answers to common questions, as well as for messages targeted for specific search terms – your own sponsored links”, Order = 1000, GroupName = “SEO”)] public virtual bool BestBet { get; set; } }}`

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating custom metafield definitions
From your Shopify admin, go to Settings > Custom data. · Select the part of your store that you want to add a...
Read more >
How to Add Custom Fields in Shopify (Online Store 2.0)
In this video, you'll learn how to set up metafields in your ... Shopify Metafields : How to Add Custom Fields in Shopify...
Read more >
Customize Your Products with Shopify Metafields
Shopify product metafields enable you to provide extra information about products to customers; resulting in a better shopping experience.
Read more >
Metafields - Shopify.dev
To enable custom storefronts to display your metafields, you can use the GraphQL Admin API to give the Storefront API access to metafield...
Read more >
How to Use Shopify Metafields For Greater Customization
Put simply, Shopify metafields are customizable fields that allow you to tailor your product listings to the needs of your store and brand....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found