piranhacms / piranha.core.docs Goto Github PK
View Code? Open in Web Editor NEWOfficial documentation for Piranha CMS
License: MIT License
Official documentation for Piranha CMS
License: MIT License
Hi,
on the doc page. The Link the the Simple Module is dead. Please fix it for Learning. :)
Thank you
https://github.com/PiranhaCMS/piranha.core/tree/master/examples/SimpleModule
I'm using .NET 5, PiranhaCMS 9.2.0
When following the instructions in https://piranhacms.org/docs/v9/tutorials/how-to-use-multitenancy, on Windows everything works as expected.
On production Ubuntu 20.04.
I added values to the /etc/hosts file analogous to the tutorial's Windows:
127.0.0.1 localhost/en
127.0.0.1 localhost/ru
Added two additional sites in the manager with localhost/en
and localhost/ru
endpoints.
curl localhost:5000/en
from inside the server returns me 200 OK with the correct content set.
with Nginx I have the config as follows:
server {
listen 80;
server_name _;
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
The default site works as expected, but when going to another language config like localhost/en
or localhost/ru
that should translate to server_ip/en
and server_ip/ru
, I get 404.
I tried adding another location (with variations commented-out and not limited to them):
location /en/ {
proxy_pass http://localhost:5000;
# proxy_pass http://localhost:5000/en;
# rewrite ^/$ http://localhost:5000/en redirect; #permanent
proxy_http_version 1.1;
# proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
What I don't understand is how it should be mapped, since it uses hosts file to work.
I believe it would be a fairly common use-case and should be even added to the documentation tutorial mentioned above.
Thanks
Hey guys,
is there a tutorial quite similar to your blog post for securing pages, but for razorpages?
What i am trying to do is making a blog secret, so only logged in user can read it.
I think i'm failing in setting the routing, because in manager all content types are shown correctly, are editable and so on.
If i try to access the blog only generates an 404 Error.
I tried setting the route at the razorpage of the archive itself, but no success.
Maybe i missed some at the endpoints or something else?
app.UseEndpoints(endpoints => { endpoints.MapRazorPages(); endpoints.MapPiranhaManager(); });
Thank you so much for your help!
Greetings,
Glorfinkel
hi thanks for your great work
i need to add header and footer Regions should only i add it to template (as i see in documents ) or should add code to manager
what the step by step way to made this goal
regards
Hi, I'm working on developping a website using piranha cms, however I find it weird how it feels almost impossible to find the api reference of piranhacms
I can find some documentation explaining the structure of the project etc but when it comes to describing all the classes and all their members and methods I find almost nothing.
I do need it because I work on visual studio code and the intellisense doesn't seem to be working properly in cshtml files even with the razor extension, so I wanted an easy way to be able to check the members of the classes I use
for instance i'd need the api reference of the SitemapItem class
Hi,
it could be an improvement extend searches for all fields in api services.
Samples
search page by name
search media by filename,
search site by cultures, ....
Hi,
When renaming a ContentTypeRoute all pages that were created with that page type return 404.
The only way to fix it seems to be to delete the pages and recreate them.
I was confused by why i was getting empty pages after renaming the route.
I didn't expect the route to be saved in the database.
That should probably be documented.
Also maybe the the route should be updated when the page is saved or maybe an update all routes button in the settings.
Hello,
I'm trying to create a custom archive + post type for a FAQ-Area on my site (razor pages).
Following the docs I created a FAQArchive and an FAQPost
namespace landingpage.Models.PageTypes
{
[PageType(Title = "FAQ Archive", UseBlocks = false, IsArchive = true)]
public class FAQArchive : Page<FAQArchive>
{
public PostArchive<FAQPost> Archive { get; set; }
}
//var model = await api.Pages.GetByIdAsync<SimpleArchive>(id);
//model.Archive = await api.Archives.GetByIdAsync<SimplePost>(...);
}
namespace landingpage.Models.PostTypes
{
[PostType(Title = "FAQ Entry")]
public class FAQPost : Post<FAQPost>
{
}
}
I can create a page with the FAQArchive-Type and add posts of type FAQPost - so far, so good.
Now when I navigate to the page (either preview or not) the page stays empty. I already tried to create a custom .cshtml file for my types but with no success.
So what is missing to complete my task ?? Do I need to setup some routing? Where would I place the view markup to have a custom rendering of my archive and its posts?
kind regards
The title says it all, I have spent 2 days trying to rework code to use an approach other than an identity based db approach, and frankly wouldn't wish it on anyone.
There is simply not enough serious examples to provide guidance, and the documentation there is 5% of what it needs to be with the policies, claims, attributes etc that are baked in. Even after I dig through the source code, the results I am left with feel more like hacks than designed approaches, and thats a pitty.
I have used this project on and off since 8.0, and while I love the features, the entire auth context has become a technical debt I cant justify to others anymore.
Alternatively if maintaining the documentation is to much work give me the option where exactly 0 auth is baked in, and we can implement ourselves.
I followed the 5 minute startup guide on the front page of https://piranhacms.org/ and then started working my way through the steps on Microsoft's Host ASP.NET Core on Linux with Nginx. I got as far as Configure Nginx step.
I could launch the app and get to the main content pages, but trying to access the manager pages at (~/manager) would fail to login. I could get as far as the login page, but after entering the out of the box user name and password, Nginx would return a 403 error. After enabling error logging, I discovering that the app was sending too big a header, I used this blog to resolve the issue:
Nginx Proxy: upstream sent too big header while reading response header from upstream
Ironically, I should have pushed through with the rest of Microsoft's page because they later make mention of long request headers and changing buffer sizes, as well as the Microsoft's hardening steps also changes the buffer sizes.
The CMS documentation should make special mention about setting the buffer sizes for Nginx if the users are planning on using it as their reverse proxy.
https://piranhacms.org/docs/tutorials/securing-pages
This line: ctx.Response.Redirect("/login);
Change to: ctx.Response.Redirect("/Login");
I am trying to add a user page that requires authentication. So I added a user with rights to view pages, and nothing else, but he isn't able to login, at all. You are just redirected to login page again, no error.
As far as I have tested, you have to be administrator to login.
The user should be able to login, and ONLY see his own information, something I will make.
Is this possible?
Hi, The docs show a CMSController.cs for the Razor template but it appears to not be included.
Getting started with PiranhaCMS is very difficult for a new user. The existing documentation is written for developers who have already committed to using PiranhaCMS. It's not geared towards .NET developers with no prior knowledge or end-user who wants to evaluate it.
When I fired up PiranhaCMS for a second time today, it started out in the site mode, but I needed to change some of the content. There was no single place in the documentation which describes how to login into the manager. A google search didn't yield any specific results. Since I couldn't remember how I managed to login into the manager the first time I installed PiranhaCMS, I became frustrated.
Eventually, I opened up the database using an SQLLite client to find the username and guessed the admin password. I also found the URL for the manager by searching my browser's history. As I am writing this, I wondered if the username and password were somehow given during the installation process. A search in VS gave me "Setup/index.cshtml" and the username and password appear in the HTML. This is the last place I would expect to find this information!
I understand the vision for a lightweight and highly configurable CMS system, but without adequate user level documentation, it may be one of the dozens of CMSes that wind up in the recycling bin during an evaluation out of frustration. I would add user level documentation covering everything from installation to managing content.
I would like to implement a secret page.
The little I have gathered, is to add this to the startup.cs
App.Permissions["Application"].Add(new Piranha.Security.PermissionItem
{
Name = "WebUser",
Title = "Web User"
});
Then in my controller, I add this
[Authorize(Roles="Buyer")]
[Route("page")]
public async Task<IActionResult> TraustiPage(Guid id, bool draft = false)
I have set a role Buyer to include WebUser. Other than that, he does not have any other rights.
I am correctly taken to the login page, with the correct redirect url, like
http://localhost:5000/manager/login?ReturnUrl=%2Ftrausti%2Fpage
But once I do login, I go back to the /manager site with the following url
http://localhost:5000/manager/login?ReturnUrl=%2FManager
I am using Piranha CMS template for Web, version 8.1.0
I was running through the documentation in order to set up a simple implementation of Piranha and when I pulled in one of the code snippets it didn't compile. Would you accept a pull request in order to fix this?
I have my piranha headless project and i've tried to implement my custom authentication following the steps in this link https://piranhacms.org/docs/master/extensions/authentication, once I try to login I receive this exception:
Is there any steps I forgot from the documentation ?
Thanks for any help in advance!
I have been using Piranha CMS with MySQL. Taking a database dump is easy enough, but restoring data is practically impossible.
The foreign key issues and such prevent you from doing a restore.
Is there a preferred way to do restore?
How to add social/oauth2 authentication?
Hi all, I am trying to call the api/page/{slug } api and I am getting the below error. Can anybody help point me in the right direction Please?
System.InvalidOperationException: No policy found: PiranhaApiPages.
at Microsoft.AspNetCore.Authorization.DefaultAuthorizationService.AuthorizeAsync(ClaimsPrincipal user, Object resource, String policyName)
at Piranha.WebApi.PageApiController.GetBySlug(String slug)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
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 ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|25_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 ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.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 Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Accept: /
Host: localhost:7021
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36
:method: GET
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Cookie: ai_user=zN8tP|2021-12-15T16:07:54.889Z,ai_session=H0vwZ|1640291151409|1640292641388
Referer: https://localhost:7021/swagger/index.html
sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Google Chrome";v="96"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
sec-fetch-site: same-origin
sec-fetch-mode: cors
sec-fetch-dest: empty
Reading through the documentation, especially on a mobile device (transit is a great time for me to catch up on technical reading) feels like a real chore constantly having to open the hamburger menu and find my place, then select the next page. The docs pages should have positional awareness and provide "previous" and "next" links. Here's a simple mockup I made in Chrome dev tools.
Are there any instructions on the best way to customize the manger? I see how to add to the menu, but are there examples of adding new content types in the admin?
I'm trying to add Piranha to a Razor pages application and I'm finding the documentation so lacking that it's impossible to get a simple application running.
My attempt can be viewed here https://github.com/Neutrino-Sunset/PiranhaTest1
I've created a new Razor Pages application and followed the instructions in application-setup.
Without options.AddRazorRuntimeCompilation = true
the app starts and displays the standard Index page for a new Razor pages application.
If I then navigate to ~\manager
and publish an instance of SimplePage with the title First Page
that then breaks the application, the default Index page no longer loads and returns 404. Editing the SimplePage I just created in the manager shows that it's been created with the default slug first-page
, but navigating to that address also returns 404. The logging shows nothing useful like why the routing has failed, just loads of SQL queries.
I've had a look at the Razor template application and the startup for my code appears exactly the same as the template application. The template application isn't really useful in the case where you want to integrate Piranha into an existing application though, since it doesn't actually have any Razor pages mapped by the standard Razor Page routing at all, its entire content is served by Piranha.
Clearing the DB and adding options.AddRazorRuntimeCompilation = true
the Index page loads, (very slowly) and with the footer broken and attached to the bottom of the content instead of at the bottom of the page.
If I then navigate to ~\manager
and publish an instance of SimplePage with the title First Page
that then breaks the application again, but in a different way. Now navigating to either the Index page or to first-page
just renders my blank Page
template.
The documentation on Routing and Advanced Routing has no information on how any of this works using Razor Pages and instead demonstrates an MVC controller based approach.
The Razor Pages template application uses pages that use a Piranha.Models.Page
as a model instead of a standard AspNetCore.Mvc.RazorPages.PageModel
, but unlike the controller based implementation described in the doucmentation this doesn't demonstrate how you would handle querystring arguments, nor how you would inject any dependencies into the model. I've attempted to achieve this using a standard Razor PageModel in my commented out Page.cshtml.cs
but that doesn't work either.
I've been floundering with this for a few days now and could really use some help.
Hi,
When I click read more in the docs pages I come back to the same page
Can you also please provide an code example on how to render the custom posts in the custom archive
I noticed that Media and has the Media versions. All the images I have uploaded to the system do have thumbnails.
How do I access them? The Media.Versions.Object does not seem to have any way of generating url for the thumbnail?
Short question, how can I get the thumbnail if available?
I have been trying to style the login page, but can not find any way to do so.
The included ParamService can easily be used to store custom config ParamService. Add an article and tutorial on how to implement this.
A very brief section on using "dotnet new". Never seen it before, but OK. Always just "create new solution" but hey, I like learning things and stuff.
An even briefer subject on using SQL Server. Implementing with software I've never seen, yeah sure, lets see if this works.
Authentication using said SQL database, well I just cut-n-paste the one sentence on this topic.
So lets deploy...OK...how do I do that? I use IIS in production, so publish to IIS folder. Nope, not working.
There is zero documentation on deploying this software, in any configuration, on any platform.
Think one of you guys could find the time to write 2 documents. One for .Net Core stand-alone deployment. One for IIS deployment. Either one would be great.
Thanks,
Have A Nice Day!
Hi!
The issue is more of a question than an issue. I'm currently in the process of adding a page to the Manager, but I'd like the page to use a vue template. To give you an idea, say I'm trying to redo the same pattern as the PageList with the select-item template.
I've read on how to add module script files, but what would be the good way to add a vue file into the mix?
Thanks in advance!
Bruno
Hi,
we're using an OpenID server for authentication. After switching Piranha from 9 to 10 it was not possible to save/publish pages or to store site properties. After investigating the log messages, I found that the antiforgery cookie was not present.
The built in authentication method (LocalAuth) redirects after a successful login to "/manager/login/auth" where the cookie will be set.
After several tries I ended up in writing a middleware which redirects to "/manager/login/auth" if the first call to the manager appears (I did not want to copy and paste the code from AuthController.cs) .
A few comments on this:
Do you have other ideas or solutions for the problem?
Thanks.
Hi, I found this Piranha tutorial page on securing pages using Piranha CMS. It refers to an attribute called PageTypeRoute which looks like it got added in this commit back in 2017, but is no longer in the master branch.
Did this attribute get moved or is there an alternate technique I should be using to set up per-page authorization?
Thanks!
Trying to get started exploring the new Piranha Core, but running in to an issue on first time setup. I've done a clone on the full project source, currently on Master.
LogoId
column on the Site.20200625060542_AddSiteLogo.cs
I'm not sure if the migration is failing, or if it's simply not executing. I'm not as familiar with EF migrations so some guidance is appreciated.
I have several websites on Piranha CMS, all are using Azure Blob Storage. Piranha uses the container's public URL when showing images, e.g.
<img src="https://holtwebsiteslive.blob.core.windows.net/holtdoctors/307249f4-e376-48db-9043-23cc672a1276-wellbeing_2.jpg" alt="image">
I don't want this URL to be exposed in the HTML, or for file downloads. Azure Blob Storage only supports adding custom domains with HTTPS using Azure CDN. I noticed in the Piranha documentation for the Azure Blob Storage module this:
It's very easy to connect Azure CDN to Blob Storage.
I have successfully setup my Azure CDN, but how do I now use that with Piranha CMS?
Thanks.
Init the init code in the example for Modules it shows using a HeaderBlock but that is no in the Extends library.
Reference:
piranha.core.docs/src/06. Extensions/04. Modules.md
We want to use Piranha to serve as a host for a blog site. We want different authors to contribute content to the blog, without having their own logins to the CMS. We would like to add a simple string field to the post type so that we could set it just like we do the "Publish date" or "Excerpt". Can you provide direction on doing this?
I am considering writing my own data layer (for performance reasons) instead of using EF (the only option provided out-of-the-box). I don't see any documentation on what is required to implement the data layer though. Is it as simple as implementing all the interfaces in https://github.com/PiranhaCMS/piranha.core/tree/master/core/Piranha/Repositories or is there more to it?
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.