-
Hi, I'm implementing my own theme module and attempting to retrieve the "Content Type" I created in the admin backoffice, from within the controller. I need to do it when I get the page, in a GET action that serves my Razor view. I tried using
Upon reviewing the documentation, I saw that there is a tag helper for the frontend that facilitates this process in Razor views. But my goal is to perform this action inside the controller (later in an handler class) and then map the Content Item to a class. but I want to do this inside the controller and then map the According to what I have found, How can I do this? Is there documentation that explains the best practice for retrieving a specific Content Item inside a class rather than in a view? Should I use the APIs? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi everyone, I read here "Refactor IContentAliasManager to IContentHandleManager" that the I was interested to retrieve my Content Item by using the alias, and after adding the "Alias" content parts, in my "Index" content item, it was possible to retrieve the Id using the alias, and then search the specific "Index" content item. Here an implementation example (of course I will do this not in the controller, later I will implement it in an handler):
If you are curious to see how the implementation of Thank you |
Beta Was this translation helpful? Give feedback.
Hi everyone,
I read here "Refactor IContentAliasManager to IContentHandleManager" that the
IContentAliasManager
was refactored, and now it's been in useIContentHandleManager
, that expose oneGetContentItemIdAsync(string handle)
method trhough it is possible to retrieve a Content Item by Id:"contentitemid:{the content idem id string}"
, by slug:"slug:{slug name string}"
, and by alias:"alias:{alias name string}"
.I was interested to retrieve my Content Item by using the alias, and after adding the "Alias" content parts, in my "Index" content item, it was possible to retrieve the Id using the alias, and then search the specific "Index" content item. Here an implementation example (of cour…