Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Apr 09 04:56
    tidyui commented #1577
  • Apr 08 15:57
    jensbrak commented #1577
  • Apr 08 14:50
    horacioj commented #1577
  • Apr 08 14:40
    horacioj commented #1577
  • Apr 08 11:46
    tidyui milestoned #1578
  • Apr 08 11:46
    tidyui labeled #1578
  • Apr 08 11:46
    tidyui labeled #1578
  • Apr 08 11:44
    Magnusalt commented #1578
  • Apr 08 11:43
    Magnusalt opened #1578
  • Apr 08 09:49
    tidyui labeled #1577
  • Apr 08 09:49
    tidyui labeled #1577
  • Apr 08 09:49
    tidyui commented #1577
  • Apr 08 06:47
    jensbrak commented #1577
  • Apr 07 22:28
    horacioj commented #1577
  • Apr 07 17:08
    horacioj commented #1577
  • Apr 07 14:42
    cristian-rios commented #1568
  • Apr 06 23:08
    horacioj opened #1577
  • Apr 06 11:58
    tidyui closed #1576
  • Apr 06 11:58
    tidyui milestoned #1576
  • Apr 06 11:58
    tidyui labeled #1576
Felipe Pergher
@FelipePergher
I will check that
Felipe Pergher
@FelipePergher
Now seeing the error i found the problem, my custom page hook are having a excetion, thanks for the help
horacioj
@horacioj
In 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?
horacioj
@horacioj
The items are like this:
                items.Add(new SitemapItem
                {
                    Title = "the title",
                    Published = DateTime.Now,
                    LastModified = DateTime.Now,
                    Permalink = "/the-url",
                    IsHidden = false,
                });
horacioj
@horacioj
Solved. The items need also MetaIndex = true
jensbrak
@jensbrak
OT/Not Piranha related but for a Piranha-thing: Anyone in here fluent enought in dotnet mvc/razor that can tell me how it gets/determines the 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.
Reason I'm asking: want to serve the razor pages with localized static content based on embedded files. There are a lot of different approaches out there but I'm confused
This link should provide info on how to control the behavior.
jensbrak
@jensbrak
@mikaellindemann Exactly what I was looking for (I believe lol!). Thanks alot! Wonder why I managed to miss that one. Nevertheless, that should get me going - perfect! :) <3
kirtikapadiya
@kirtikapadiya
Hi
I am new to Piranha CMS.
can anyone explain me how to use hook media ?
I want to scale image using hook media .
I use HtmlField and uploaded image using Tinymce editor .
kirtikapadiya
@kirtikapadiya
@tidyui
If I upload high quality image it take more time load on page because of this I want to resize image.
I try with creating media hook but it didn't work for me .
App.Hooks.Media.RegisterOnAfterSave(media =>
{
media.Height = 200;
media.Width = 200;
});
Filip
@filipjansson
@kirtikapadiya Instead of trying to scale it in the hook on upload, you can use the built in way to manage image scaling. https://piranhacms.org/docs/master/architecture/image-processing
kirtikapadiya
@kirtikapadiya
@filipjansson I use HtmlField to upload image for description of our blog.
I got value using @Html.Raw(Model.ItemDescription)
Is there any way to scale image in Tinymce editor ?
Håkan Edling
@tidyui
@kirtikapadiya Well the image picker doesn’t allow for selecting a scaled version of an image, only the base image. And since you don’t have any media references in an html-field, just raw html, in the end you will be forced to update the images urls in runtime using JavaScript

@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

And if you use an image block you will have access to the media object and can just request an image of the desired size like Filip wrote
Håkan Edling
@tidyui
If you for example take a look at the editor Ghost provides, which also is based around a block system, their content block doesn't even support images (which I personally think is preferable), but we've kept it for backwards compatibility.
kirtikapadiya
@kirtikapadiya
@tidyui sorry for silly question, but i really don't know about how to use use ImageBlock

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
});

Håkan Edling
@tidyui
@kirtikapadiya These are the blocks of the page, i.e the part of the page that the editor fully controls.
blocks.png
And yes, you should be able to add them from code like that as well.
kirtikapadiya
@kirtikapadiya
Thanks @tidyui
kirtikapadiya
@kirtikapadiya
@tidyui @filipjansson
I have one question related to blog design
Suppose i have two different blog design page
first one have only description
and second blog page design have firstimage ,firstdesctiption, secondimage , seconddescription this four field
than any way to how this holds together and if you can have multiple page designs on same page type?
Any existing feature available in Piranha CMS ?
Chris
@GangsterGeek89

@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

Also Take a look Here and then the controller Here This is a good example of using multiple routes
Håkan Edling
@tidyui
@GangsterGeek89 Correct!
kirtikapadiya
@kirtikapadiya
Thanks @GangsterGeek89 and @tidyui for quick reply
In my project i use ArchivePage
/// <summary>
/// Blog page for the site.
/// </summary>
[PageType(Title = "Blog archive", UseBlocks = false)]
[PageTypeRoute(Title = "Default", Route = "/blog")]
public class BlogPage : ArchivePage<BlogPage>
{
}
can i use same thing with ArchivePage type ?
Håkan Edling
@tidyui
@kirtikapadiya Yes the feature is the same for all page and post types
scyth666
@scyth666
Hi, I added a new Field. I also added a new column in database, I can call on PageApiController the new Database date without Problems. i changed the SiteModal cshtlm and added an new textbox, but for some reason i get an error that the Textbox is undefined in vue. And when i save the new site this Texbox gets more or less completly ignored. Where do i need to define the Texbox or can get it to work? Can somebody help me?
Håkan Edling
@tidyui
@scyth666 We do not generally give support if you alter the database or source code. We only try to give support for applications based of the NuGet or equivalent source code. Why? As soon as you modify the code we have no control of it
zakkeg00
@zakkeg00
Hello All. I have had a problem lately where the manager get's logged out after 40 seconds on the production server. i am unable to replicate it on local or on Docker. Any Ideas. Please.
Sorry i am also using piranha 8.4 on .net core 3.1
Håkan Edling
@tidyui
@zakkeg00 Maybe production is running in a cluster and requests are not always redirected back to the same server holding the admin session given that regular in memory state management is used?
zakkeg00
@zakkeg00
is possible is hosted on 2 servers. i enabled distributed cache hoping that would help.
Håkan Edling
@tidyui
@zakkeg00 Cache and state management are two different things! Take a look at this article! https://docs.microsoft.com/en-us/aspnet/core/fundamentals/app-state?view=aspnetcore-5.0
1 reply
sourcex
@sourcex
Hi- I created a project last year and want to put the work into a module now. I'm struggling trying to figure out if I can put custom pages in a module or I should have architected the app a bit differently. Is there an example of registering a page in a module?
Håkan Edling
@tidyui
@sourcex Yes, take a look at the core Identity module which has its admin views embedded into the project. https://github.com/PiranhaCMS/piranha.core/tree/master/identity/Piranha.AspNetCore.Identity
sourcex
@sourcex
@tidyui Awesome. That module also addresses a couple of other questions that were down the line as well. Thanks
jensbrak
@jensbrak
@sourcex - not sure what you expect from your module. I've recently made a module that has custom page (in manager that is). It may give some ideas too.
Jojo Aquino
@jfaquinojr
Hi guys, has anybody created or know of a Forum module for PiranhaCMS or .NET in general? I was hoping not to build one from scratch to save some time... Thanks in advance
horacioj
@horacioj
Felipe Pergher
@FelipePergher
Hey guys, I have a quick question. If I need to remove or extend a block from the default blocks of project, have a way to do that?
Chris
@GangsterGeek89

@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; }
}
Felipe Pergher
@FelipePergher
Nice, that's exaclty what I need, I was trying found a way to make the update, I don't have thought about unregister possibility, I will try later, thank you very much :)
Chris
@GangsterGeek89
@FelipePergher Great stuff good luck :)
Håkan Edling
@tidyui
@FelipePergher App.Blocks.UnRegister<T>()
Mateus Bellozupko
@mateusbellozupko
Hey there. I'm trying to add a default value to my fields, but it is not working, anything I'm missing?
[Field(Title = "Scroll Text", Placeholder = "Scroll Text")]
[StringFieldSettings(DefaultValue = "scroll")]
public StringField Scroll { get; set; }