piranhacms / piranha.core.templates Goto Github PK
View Code? Open in Web Editor NEWProject templates for Piranha.Core
License: MIT License
Project templates for Piranha.Core
License: MIT License
Seems tapping + for new blocks does not do anything in 8.4.x Razor Template
Pages can be added but not blocks of existing ones
Stack trace:
Connection id "0HM24SEFA3ORG", Request id "0HM24SEFA3ORG:00000003": An unhandled exception was thrown by the application.
System.NullReferenceException: Object reference not set to an instance of an object.
at Piranha.Runtime.AppDataList`2.GetByType(String typeName)
at Piranha.Manager.Services.ContentTypeService.GetBlockTypes(String parentType)
at lambda_method(Closure , Object , Object[] )
at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Piranha.AspNetCore.SitemapMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
at Piranha.AspNetCore.IntegratedMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
at Piranha.AspNetCore.Security.SecurityMiddleware.InvokeAsync(HttpContext ctx, IApplicationService service)
at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests[TContext](IHttpApplication`1 application)```
Project templates has instructions to delete the ~\seed
directory and the SeedController
, but the controller is actually named SetupController
.
Just fix the view to mention the controller by its correct name.
There's no meta-tags generated in the web templates at the moment.
For the Razor based templates I needed to change
@if (Model is Piranha.Models.IMeta) {
<partial name="Partial/_Meta.cshtml" />
}
to
@if (Model.Data is Piranha.Models.IMeta)
{
<partial name="Partial/_Meta.cshtml" model="Model.Data" />
}
to get the meta data in the header
Add parameters for creating a project with the suitable packages, like database and storage provider.
When the DisplayTemplate
for the PostBlock
renders a linked post it would be nice to render the selected Category.
The .cshtml
view for the ImageGalleryBlock
should skip block items that reference missing images.
Hi,
considering SEO, for new site, I need to put all contents in site root (eg. do.geekzl.com
).
Then I also need pagination in the home page.
Does piranha.core.templates
support these requirements?
If yes, how to setting in the manager page to achieve it?
Thanks~
If you create a new project from the template piranha.blog.razor
and do not seed it, there is no "Information" tab added to the editor for you to configure site logo and other site details.
This results in a null exception on the default layout template:
I suggest moving the migration portion of the site information fields into the main migration as opposed to the seeding portion otherwise the default template has this issue.
Hi,
I started to work with templates. I suggest to switch them to Webpack and NPM instead of gulp, libman, etc.
The result is more clear in my opinion.
I changed my project using NPM and Webpack, releasing jQuery, Bootstrap, custom css, etc. and it's seems better that the current one. If can be useful I can share code (but I'm not a real expert with webpack).
I also created a FancyBox Image Block that is similar to Image Block but uses FancyBox, and it's more easy using NPM and Webpack to add it to the project.
anyway, thanks for the code
Hi,
it is possible to update Piranha Templates (mvc/razor) to version 9.2.0 ?
Thanks.
Regards.
Change the "Hero" table to allow Primary Media (instead of Primary Image).
The current code base (28th March) has video support added.
In the "+" Primary Image section of the Hero tab, you can select a video to upload, but only images are displayed.
The ability to add a hero/background video would be a nice enhancement.
Assuming a couple of tweaks are required.
Hi dear i build application
i upload image and i filled image metatags title and alt text
but its not show image alt text and title in web site
you can see result in website https://www.admoteknikservis.com
version is piranha 8.4.2
best regards
Adem
Add example code in the templates for how to add permissions using the new features in 8.4
. The code can be commented out by default.
The MSBuild conditions are not working correctly causing package references for SqLite
to be included even when they shouldn't be.
Create a project template for building a Piranha module. Could also be a separate template for a module with manager views.
Only the root level of assets/scss
is included in the web templates making it impossible to build the assets.
Stumbled across the following lines, which I found misleading:
https://github.com/PiranhaCMS/piranha.core/blob/2cf3647caf7a0fdc4bd248051554fc4b6fe570f2/examples/RazorWeb/Pages/Archive.cshtml#L73-L78
Because to my understanding, the model
https://github.com/PiranhaCMS/piranha.core/blob/2cf3647caf7a0fdc4bd248051554fc4b6fe570f2/examples/RazorWeb/Pages/Archive.cshtml#L2
does not include posts with PostInfo.Published == false
. (And if it would, the post shouldn't be shown at all?)
To resume: Isn't the if statement above redundant, and to be removed for more clarity?
This is an FYI Ticket
I'm new to Piranha and wanted to check out the samples.
Went here: https://piranhacms.org/docs/master/basics/project-templates
Windows 10: dotnet new piranha.mvc --database SQLServer --storage FileStorage
Creates a project using SQLLite and Blob storage. I tried lowercasing them: -d sqlserver --database sqlserver no effect
I know I can change all the references in the project, but it would be nice if the examples just worked right out of the box. I'm just browsing so I ran it using SQLLite anyway.
Nowhere on the page does it list the default login for the maintenance page. Have to search for that now too so I can see the admin.
Update the package reference for Piranha.Manager
to 8.3.1
due to a bug in the manager package deploy.
Probably a lot of people gonna need paging for blogs.
I've only tried this using dotnet/publish and using debug in VS on Mac, but both fail the same way.
Steps to reproduce:
NullReferenceException: Object reference not set to an instance of an object. Piranha.Services.PostService.GetCategoryByIdAsync(Guid id) Piranha.Services.ArchiveService.GetByIdAsync<T>(Guid archiveId, Nullable<int> currentPage, Nullable<Guid> categoryId, Nullable<Guid> tagId, Nullable<int> year, Nullable<int> month, Nullable<int> pageSize) RazorBlog.Pages.ArchiveModel.OnGet(Guid id, Nullable<int> year, Nullable<int> month, Nullable<int> page, Nullable<Guid> category, Nullable<Guid> tag) in Archive.cshtml.cs + Data.Archive = await _api.Archives.GetByIdAsync(id, page, category, tag, year, month);
Or am I missing something here (quite possible, new to using Piranha and dotnet core)? I can provide more details if needed.
Clicking on the seed button on Start Page results in an error loading the website. The error is caused by the missing attribute (highlighted in bold letters) of the Hero property of class StartPage (StartPage.cs).
[Region(Display = RegionDisplayMode.Setting)]
public Hero Hero { get; set; }
When you create a new default .NET Core Razor Pages web app using dotnet new webapp
a launchSettings.json
file is created automatically. This file facilitates the use of dotnet watch run
which automatically opens up a new browser window with whatever is specified for applicationUrl
in launchSettings.json
.
If you do the same but using the Piranha CMS templates (e.g. dotnet new piranha.razor
) instead no launchSettings.json
is created:
Work-around: Manually copy the launchSettings.json
file from a new default .NET Core Razor Pages web app to your own app.
Add some basic input validation to the templates. Would not only prevent Piranha from crashing if invalid input is made but also provide a good example of how to do it.
For instance, an invalid e-mail address of a comment will cause an exception that will crash the application. I assume this is the proper behavior of Piranha.Core but it would be both pedagogical and better if application/templates won't crash upon quite normal 'misbehavior' of a site visitor.
Steps to reproduce the exception:
Output of application:
fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
An unhandled exception has occurred while executing the request.
System.ComponentModel.DataAnnotations.ValidationException: The Email field is not a valid e-mail address.
at System.ComponentModel.DataAnnotations.Validator.ValidationError.ThrowValidationException()
at System.ComponentModel.DataAnnotations.Validator.ValidateObject(Object instance, ValidationContext validationContext, Boolean validateAllProperties)
at Piranha.Services.PostService.SaveCommentAsync(Guid postId, Comment model, Boolean verify)
at Piranha.AspNetCore.Models.SinglePostWithComments`1.OnPostSaveComment(Guid id, Boolean draft)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Convert[T](Object taskAsObject)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.GenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Piranha.AspNetCore.SitemapMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
at Piranha.AspNetCore.IntegratedMiddleware.Invoke(HttpContext context, IApi api, IApplicationService service)
at Piranha.AspNetCore.Security.SecurityMiddleware.InvokeAsync(HttpContext ctx, IApplicationService service)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Hi,
I have uploaded an image into the page hero that contains a space and that image returns a 404.
The filename is "Test 1024.jpeg"
This localhost page can’t be foundNo webpage was found for the web address:
http://localhost:50353/uploads/5b20ec7d-03d7-44ff-b3f3-d32ac1ee25e2-test
The same image load if used in image block. In image block the path is:
/uploads/5b20ec7d-03d7-44ff-b3f3-d32ac1ee25e2-test 1024.jpg
The code in the Hero image doesn't seem different then the Image block code.
Hero:
return $"style=background-image:url({Url.Content(Model.Hero.PrimaryImage)})";
Image block:
<img
src="@Url.Content(Model.Body)">
Expected behavior:
Since it's almost 2020 I thought it would be a good time do improve and do some redesign of the project templates. Please leave feedback on:
When there are a lot of entries in an archive, the pager runs off the edge of the screen on both sides. You can scroll to the right to get to the end of the pager but it won't allow you to scroll all the way to the left to get to the first set of pages. I'm attaching a screenshot below to illustrate (you can see the scrollbar can scroll right, but not left). I tested in Edge & FireFox.
My workaround currently is to increase the page size so that there are less pages.
To showcase the new simplified security features, add to the templates:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.