AI OnAI Off
Hi Justin,
I can't see anything wrong with your implementation.
However just to be sure can you share the 'Blog Main Page' controller?
Thanks
Paul
Thank you Daniel. I have tried publishing, but the reason I did not press the publish button for that screenshot, was because when I press it, the content disappeared.
See the first screenshot for what it would have looked like had I pressed publish.
Hi Paul,
Thank you for telling me to look in my controller!!
I found the issue was in my ViewModel Constructor.
I forgot to pass the value of the contentarea from my `BlogMainPage` to my `BlogMainPageViewModel`
The issue is no longer happening. See below for reference.
in BlogMainPageController.cs...
public class BlogMainPageController : PageController<BlogMainPage>
{
private readonly IContentLoader _contentLoader;
public BlogMainPageController(
IContentLoader contentLoader)
{
_contentLoader = contentLoader;
}
public IActionResult Index(BlogMainPage currentContent)
{
var model = new BlogMainPageViewModel(currentContent);
return View(model);
}
}
in BlogMainPageViewModel.cs...
public class BlogMainPageViewModel : BlogMainPage
{
public IEnumerable<BlogMainPage> BlogPosts;
public BlogMainPageViewModel(BlogMainPage model)
{
Title = model.Title;
Subheading = model.Subheading;
Description = model.Description;
BlogCards = model.BlogCards; //line that was missing that fixed my issue
}
}
Hello Comrades,
My issue is that I am able to see the content when I am modifying the content area, but after I publish or refresh the page, it does not go through the template controller that I have defined.
It does however, go through my controller when I am modifying or adding `Blog Pages` to the content area.
When I add a breakpoint, it only hits the breakpoint when I hit edit and modify the content area (selecting new blog post pages to add) When refreshing, the breakpoint does not get hit. (And therefore my content is not rendering)
I am using Optimizely 12.27
I have a simple blog site with that has a main page. Under the main page, there are blog pages. To do this, I have created a content area in he `Main Page` class, that can accept `Blog Pages`
in BlogMainPage.cs...
In my view `BlogMainPage/Index.cshtml`
In my `TemplateCoordinator.cs`
For reference: here are some images: (Ignore the first content area)
Before Editing/After Refresh/After publish
After editing:
Website view:
I can see "Changes to be published" shown on your "After editing" screenshot.