In layout it should display with this line:
That will render anything in the BeforeContent zone, assuming what you did worked.
I'm just wondering where exactly did you add that code?
I ended up getting it working by supplementing my own RoutePart driver but I've since discovered there are probably simpler ways especially if you needed to do a lot of this stuff:
public class RoutePartDriver : ContentPartDriver<RoutePart>
private IWorkContextAccessor _workContextAccessor;
public RoutePartDriver(IWorkContextAccessor workContextAccessor)
_workContextAccessor = workContextAccessor;
protected override DriverResult Display(RoutePart part, string displayType, dynamic shapeHelper)
var context = _workContextAccessor.GetContext();
if (displayType == "Detail")
var headShape1 =
shapeHelper.Parts_Header_RoutableTitle(ContentPart: part, Title: part.Title, Path: part.Path);
return new DriverResult();
Also note that I've named the shape Parts_Header_RoutableTitle. This meant I could use Placement.info to hide the original Parts_RoutableTitle as well as adjusting the position of this one if I needed.
I reached the above method after discussion in this thread:
You can see this other thread for a possibly better way (towards the end):
But, I haven't yet tested that last method since I've already got everything working how I want with drivers.