First of all, I don't think Rendering Parameters are right place for a General Link
field. They cannot be localized, so if your content authors will set some text of the link, it will be the same for all the languages.
You may try to use field like Droplink
if you don't need a title of your link and if you always want to select Sitecore item. Or maybe moving the field to datasource is an option?
But if you really really want to parse Link Field
value without using LinkField
class, find the sample code below. Be aware that this code is tested on 1 value only, so you may need to adapt it to your needs:
public class LinkFieldParser
{
private XmlDocument _xmlDocument;
public LinkFieldParser(string linkFieldValue)
{
if (!string.IsNullOrEmpty(linkFieldValue))
{
try
{
XmlDocument xmlDocument = new XmlDocument();
xmlDocument.LoadXml(linkFieldValue);
_xmlDocument = xmlDocument;
}
catch (Exception ex)
{
Log.Error($"Attempted to load invalid xml: '{linkFieldValue}'", ex, this);
}
}
}
public string Url
{
get
{
if (_xmlDocument == null)
return null;
switch (GetAttribute("linktype"))
{
case "internal":
var item = Sitecore.Context.Database.GetItem(GetAttribute("id"));
return item != null ? LinkManager.GetItemUrl(item) : string.Empty;
case "media":
var mediaItem = Sitecore.Context.Database.GetItem(GetAttribute("id"));
return mediaItem != null ? MediaManager.GetMediaUrl(mediaItem) : string.Empty;
case "anchor":
var anchor = GetAttribute("anchor");
return !string.IsNullOrEmpty(anchor) ? "#" + anchor : string.Empty;
default:
return GetAttribute("url");
}
}
}
public string GetAttribute(string name)
{
return _xmlDocument?.DocumentElement?.Attributes[name].Value.ToLower();
}
}
and in your scenario you would use
@(new LinkFieldParser(RenderingContext.Current.Rendering.Parameters["Feed or File Link"]).Url)