Startup.cs
, inside public void Configure()
after App.Init(api);
I'm adding Sitemap items. When browsing to /sitemap.xml
and debugging the application, I see my App.Hooks.OnGenerateSitemap
is run and the entries are added. However, in the web browser, /sitemap.xml
isn't including the entries added by OnGenerateSitemap
. What I'm doing wrong?
CultureInfo
in order to serve the right translation to the .cshtml
pages. I know how to use the localization features to translate - but I wantto know the mechanics behind it. Yes, I have the code for the Microsoft.Excensions.Localization
package etc, but I might as well ask here.@kirtikapadiya If you’re building the main content using blocks the workflow is to use smaller blocks, for example a content block for the first paragraph, then a column block with a content block and an image block to get a two column layout with an image.
You could of course write the entire page in a single content block, but that would defeat the purpose of the whole block concept
means where to define this :
using Piranha.Extend.Blocks;
using Piranha.Models;
var page = MyPage.Create(api);
var image = api.Media.GetAll().First(m => m.Type == MediaType.Image);
page.Blocks.Add(new ImageBlock
{
Body = image
});
@kirtikapadiya Think you do this by setting multiple page routes on the page model and then select the page route to use from the editor, Not something I have come to do myself yet just vaquely remember reading something about it. Somthing like this taken from the Docs
[PageType(Title = "Hero Page")]
[ContentTypeRoute(Title = "Default", Route = "/heropage")]
[ContentTypeRoute(Title = "Start Page", Route = "/startpage")]
public class HeroPage : Page<HeroPage>
{
...
}
Then have relevant Page/Controller setup according to the routes you have declared
@FelipePergher I think something like this should remove a block from the manager
App.Blocks.UnRegister<AudioBlock>();
As for extending a block, I think this would just be a case of having your custom block inherit from the block you want to extend. Something like this
public class AdvancedAudioBlock : AudioBlock
{
public TextField MetaDescription { get; set; }
}