How to customize the page? - piranha-cms

I'm attempting to customize the Piranha CMS system. I'm interested in changing the layout, setting up my own styled menu and tweaking where the content on the page shows up.
Is the intent that I modify the _Layout.cshtml file to my liking?
If there's a page in the documentation that covers this, please helpfully provide the link. :)

Piranha CMS is just a framework for content management, not a website template with widgets, themes and stuff like that :) With that said, a basic Piranha CMS project is basically a standard MVC project with two included controllers, one that loads the model for a requested page, and one that loads the model for a requested post.
This means you can do anything that you can do with any normal MVC application when it comes to styling and modification.
There exists some helpers for rendering Menus, Breadcrumbs and so on. Documentation for the helpers can found here:
http://piranhacms.org/docs/api-reference/site-helper
http://piranhacms.org/docs/api-reference/ui-helper
For the helper methods that render html there are hooks for overriding all content rendered so that you can change the standard menu to your own style of html if you need. Documentation for the hooks available can be found here:
http://piranhacms.org/docs/api-reference/hooks
Regarding what can be achieved with Page types and creating templates with different regions you can check the following pages:
http://piranhacms.org/docs/pages/page-types
http://piranhacms.org/docs/pages/page-model
http://piranhacms.org/docs/pages/regions
http://piranhacms.org/docs/extend/extensions
I hope this helps you a bit.
Regards!
Håkan

Related

Add a custom page to Spartacus

Probably my question is a bit dumb as there is a lot of documentation about routing. The problem is, I am not an angular specialist, so I am missing a bit of context.
I would like to add a custom sub page (http://localhost:4200/image-upload) to spartacus. The Header and Footer should be the same. Just the content should be an upload form.
Where and how do I configure the route?
Add a new content page in CMS with page label /image-upload (with the leading slash). Spartacus routing should handle it OOTB. https://sap.github.io/cloud-commerce-spartacus-storefront-docs/adding-and-customizing-routes/
Add a layout config only if your page has custom layout https://sap.github.io/cloud-commerce-spartacus-storefront-docs/page-layout/#configuring-the-layout
Implement Angular CMS components that should appear on this page and configure mapping from CMS component type to the implementation https://sap.github.io/cloud-commerce-spartacus-storefront-docs/customizing-cms-components/#page-title

Where is the shopify editable html?

In a traditional website I would simply open the 'contact' page and add the line then upload. But i'm having difficulty understand the multiple components of shopify's theme, sections, snippets.
So my question is if I want to add a simple text line say in the homepage, where would I add this html?
It depends entirely on the theme you are using. A lot of modern themes have draggable sections which can be accessed via Themes - Customize.
If your theme doesn't have this functionality, or any functionality to add text to the homepage, I'd be surprised. But if you need to edit it by editing the code directly you can access the pages via Themes - Actions - Edit Code. The homepage will usually have a name of index.liquid.
Rather than just adding your text in there, though, I recommend you learn how to add snippets and sections to your website. It makes future edits much easier and doesn't take long at all to learn.
The beginner's guide to building shopify themes with sections
Shopify: Theme Sections

Sitefinity widgets not showing on News Detail page

Inherited a Sitefinity website. There's a news list page, which I discovered is reused by the news detail pages to display content. If I update the list page, the changes are reflected on the detail pages.
Sometimes.
I have a content block that contains a "header" text - updating this in the list page is replicated across the details pages. Adding a javascript widget to the page to inject some custom javascript replicates across the details pages as well.
Adding a new content block or css widget does not replicate across the details pages.
Is there some rhyme or reason to this behavior that I'm missing?
My specifics:
I've successfully created widgets in the MVC several times now. I essentially need to add a new widget to just the news pages. Which seemed simple enough until I discovered that news pages are not individually created pages like... well, pages... but instead are just a content piece that is dynamically inserted in the news widget on the "parent" listing page. At least as far as I can tell that's how it appears to be working.
Adding my widget to the page didn't work, as I explained above. I then tried recreating it in the page itself using javascript, content block, and css widgets, at which time I discovered that the javascript is the only one making it to the details pages. I imagine this has to do with the way javascript widgets actually make it to the page - their placement is selected in advanced options, rather than simply appearing inline.
Sitefinity widgets go beyond presentation, and actually control routing.
As such content widgets (baseline or custom) have two 'modes' that they operate in: list and detail. Slugs for details are automatically generated in the following format.
/News
/News/{News-item-slug}
Of course, a list and a detail should look very different. To accommodate that, the widgets have two separate configurable templates.
So, add your custom html and javascript to the appropriate template to have it only apply in a given mode.

Piranha CMS customisation

A few questions on customisation with Piranha CMS.
Is there a way to create additional custom site-wide items similar to those from the site helper? http://piranhacms.org/docs/api-reference/site-helper
e.g. to be able to set a phone number used throughout the site but still editable in the settings section of the manager.
Is is possible to create additional custom items for a page, e.g. page subtitle, and for those to appear in the Information section of page editing? Creating a region for say a page subtitle seems overkill.
Is it possible to create a custom page type with a region that is a collection of HtmlRegions or similar? e.g. for the purpose of managing a set of FAQs or similar enumerated content?
Is is possible to define custom settings properties for a page type?
Yes, you can add regions to your site in the same way as with page types under Settings > Sites. You then add content for them under Content > Pages > Edit Site.
You can add simple text properties on the page type. They will be shown as single line text inputs under Properties when editing the page.
No native support, however the region body can be anything that can be serialized to JSON so you have to handle this in the edit view for your region.
There is no support for injecting fields into the page settings, however if it's important you can override the whole edit view for pages and do anything you like by placing a copy of the view in the manager area in your local project. You can find the views in the github repo in the 2.2.5 branch.
Regards
Håkan

MVC5 MvcSiteMapProvider to display full sitemap

I successfully installed MvcSiteMapProvider, and got the breadcrumbs working and customizing the templates to generate Twitter Bootstrap navbar menu. Everything is honky dory. Now I'd like to have a view which sole purpose would be to display the whole sitemap hierarchy (in a tree structure, nodes would be clickable).
I've found traces of old ASP.NET sitemap solution to XSLT transform the sitemap XML file. That's not only a dead-end because it's old and doesn't look like a good idea, but I also take advantage of the annotation feature of MvcSiteMapProvider.
I don't use external DI framework.
I turn to here because my search attempts came out empty. I guess I could do something like the bootstrap navbar customization, creating some templates. But I'm sure I'm not the first one and I'd be happy to see some working code if there any out there.
Per the documentation:
Html.MvcSiteMap().SiteMap() - Can be used to generate a list of all pages in your sitemap
If that doesn't meet your needs, you could always build your own custom HTML helper to display the SiteMap per your requirements. Have a look at this answer for a demo showing how to create Next and Back links according to the document outline of the SiteMap.