You could use a propertylist with the url and the option to set the rel attribute
For a single "EPiServer.Url" property?
[ContentType(GUID = "...")]
public class SomeRandomPage : PageData {
[Display(Order = 100)]
public virtual Url PageLink { get; set; }
}
hmmm, that would be overkill I guess. You could limit the amount that could be added to one though ;) But I think might be the easiest way
Cannot accept this solution sadly. The customer has already 5 sites in production that needs this (single solution). And I don't want to force the customer to change everywhere.
Can't you use
https://world.episerver.com/documentation/developer-guides/CMS/Content/Properties/Custom-properties/
And inherit from Url? But I don't know if it's a propertystring or something else as a base property.
A custom property, even if you would inherit from Url would kinda have the same difficulties, as it would still be a different property? In your situation, with sites already in production, you could add a seperate property in which to select the rel and render them together in your view. It is/feels a bit hacky though
Yes. But in my maybe faulty logic, since it still inherits from Url it would easyly be converted to the new type?
I that seems to be the only simple solution sadly. Thanks!
For future refrence. How do I extend Url class?
How do I extend Url class? Anyone?
I want a dropdown or textbox to set the rel attribute.
Can you somehow do a editor descriptor and add the new field?
[EditorDescriptorRegistration(TargetType = typeof (Url))]
public class UrlEditorDescriptor : EditorDescriptor
{
public override void ModifyMetadata(ExtendedMetadata metadata, IEnumerable<Attribute> attributes)
{
base.ModifyMetadata(metadata, attributes);
}
}
Hi,
My client wants to extend "EPiServer.Url" class with the ability to set "rel" attibute.
Their reference on why: https://www.ranktrail.se/blogg/google-infor-nya-nofollow-lankattribut/ ( in Swedish ).
But basicly add support for
rel="nofollow"
rel="sponsored"
rel="ugc" (user generated content)
This affects "Ranking credit" for links in Google Search for example.
Any idea how to do this?