web part title in xsl - sharepoint

I'm investigating a possible solution where all web parts on my page should be rendered without a chrome, meaning that the default title portion of the web part will be hidden, but the title supplied in the web part properties should be used elsewhere in the web part.
I have found several solutions on how to get the page title but none around how I can crab the web part title and display it using Xsl, would like to return this within the ItemStyle.xsl
I used a method of return the raw xml data for the web part, but by default is the title of the web part not return, and I found no reference other than OuterTemplate.GetTitle() which points to the Title column of a list, to support my solution.
Is this possible?

It is probably not accessible through the xsl itself, as the title of the webpart is not part of the xml data coming through. If you really need it, you could show it on the page and use JQuery/Javascript to scrape it off. Otherwise, I might find a different way to provide the name, maybe with a query parameter.

Related

How to only get the "title" and "main content" of a page using puppeteer?

I'm trying to create a clone of getpocket.com for learning. On that app, every saved link gets converted into a markdown; and it seems like the it's a filtered content with only the page title and body without headers, footers, etc.
I could get the page's title using puppeteer api thru different means:
using page.title()
or get the page's opengraph "og:title"
But how do i get like the summarized version containing only the main content of the page.
Note that i don't know beforehand the "css class" of the main content since i'm planning on just entering a url in a textbox and scrape that site from there.
I have found what i've needed for this scenario.
I used the Readability.js library for making webpages readable by removing some certain html tags. Here's the library.
This library is what mozilla uses behind the scenes when rendering their reader view

OrchardCMS, how to set HTML title tag to page title

How does one dynamically set the HTML title tag on a page in Orchard?
I have a custom theme, and out of the box Orchard sets only the sitename as the page title.
looking in the Document shape, i see this
<title>#Html.Title(title, siteName)</title>
So for example, if my site is called "MySite" and my page is called "MyPage", the title should be
<title>MySite - MyPage</title>
There is another question that seems to deal with a similar issue, though it references a Title Override module as the answer. This module no longer works with newer/current versions of Orchard.
Alternatively, I've considered just using javascript to set the title, but
a) I don't know how to get a handle on the page title and
b) I don't know which shape in which I would do this
thanks in advance
#Html.Title is just a helper, for which you can find the source code here: https://github.com/OrchardCMS/Orchard/blob/6720b71cf3474a9a7b8a8cc9a99d58b1e733acfa/src/Orchard/Mvc/Html/LayoutExtensions.cs
As you can see, it takes a variable number of parameters. If you omit the site name in your call, it won't get output.
<title>#Html.Title(title)</title>
Note that you could also simply do <title>#title</title>.

Can I render all zones to an HTML string in a controller method

I'm trying to render the HTML for a content item to a string from within a controller action. Technically I just want to get the "body" part of it without any header/footer stuff. I want to do this so I can get a content item rendering the way I want once, and then display it as a normal orchard page OR by requesting the HTML for the content item via ajax to display it in a div in a JavaScript app. I don't want to have to manually render everything in the JavaScript as that would be duplicating the layout logic I already did. I want to re-use the bulk of the server side rendering so any changes are reflected in my normal orchard page and my JavaScript page. I've been digging into the code and searching everywhere and have gotten close but not all the way there.
I found these:
How to render shape to string?
Using FindView in Orchard
In my controller I have:
var shape = _contentManager.BuildDisplay(contentItem);
Using either of the two methods above, I can render that shape to an HTML string in my controller. All was golden. I was getting the body of that page and using it in JS. Then, I changed a placement file:
<Place Parts_Common_Body="Content:1" />
was changed to:
<Place Parts_Common_Body="/AsideFirst:1" />
The body moved where I wanted it (AsideFirst) in my normal Orchard page but disappeared from the HTML retrieved using the two methods above.
If I look at shape.Content.Items after the BuildDisplay call, I can see the item for the body is no longer there... why is it not rendering all the zones? Or, I guess a more specific question is why is the BuildDisplay method not building the complete shape? Is there a way I can make this work?
I tried a million different things and eventually got this working. Not sure I totally get it yet, but I think the problem had to do with the fact that I was using shape.Content and I'd moved stuff out of the Content zone. And maybe when I was looking at what the BuildDisplay method was returning I was just not looking at some newly created zone that actually did had the stuff I thought was missing. Clearly I need to learn more about zones and shapes... Anyway, I have a new zone called "MainInfo" now that I created in a placement file. I get a MainInfo property on the main shape returned form BuildDisplay and pass shape.MainInfo to the view rendering code and all seems to be working well now.

Orchard CMS create theme view for my content type

I am using orchard cms with the bootstrap theme.
I have created a content type: House
it contains FIELDS
image (media picker field)
Property Type (taxonomy field)
Location (taxonomy field)
It has PARTS
common
body
publish later
Title
Autoroute
I want queries of houses and be able to choose the view/ layout for them
e.g. layout called HouseList (for sidebars mainly) which will render: title, image and link to house, possible location and type but with out the links as defaulted. And then a fullDetails layout and a image only layout (so i can show a jquery image reel a widget say in a quadzone) How can i do all this please, i have tried in view Content-House.cshtml etc but i cant access the details model.content to choose what to display.
Im sure when i get the idea of how to do 1 i should be able to sort the rest. I have read documentation etc but there are so many different ways, ie placement file, change the parts, contents, create classes to handle display etc. sureley i am missing something simple like create a view for each list i want eg. houue-list, house-details, house-imageONly and then manipulate content.
Please help i have been trying different things for getting this site running for weeks and not getting very far. Examples would be fantastic but i have searched google for hours and found similar but nothing with enough details for a meer beginer.
Thanks
The standard way of doing that is placement to move things around and alternate templates for the different parts and fields. You can specialize placement and alternates with the display type, which is Summary when rendering in a list such as what a projection returns, and Detail for the detail view. More info on placement can be found here: http://docs.orchardproject.net/Documentation/Understanding-placement-info and on alternates here: http://docs.orchardproject.net/Documentation/Alternates
Now if you prefer to completely take over the rendering and do without placement, here are a few posts that may help:
http://weblogs.asp.net/bleroy/archive/2011/07/31/so-you-don-t-want-to-use-placement-info.aspx
http://weblogs.asp.net/bleroy/archive/2011/03/27/taking-over-list-rendering-in-orchard.aspx

Overriding Core Shapes - Orchard CMS

I currently have a Content Type called "News" which is very simple (No custom properties etc.). I am trying to style this Content type when it occurs on a page of a specific layout, in this case a "News" page.
So - I have the layout that a News page will inherit from (Layout-url-News.cshtml), however I cannot seem to get the Content to display or inherit from a template (I have tried creating alternates such as Zone-url-News.cshtml and Zone-Content-url-News.cshtml, however both result in having no content at all.)
I had create both of the mentioned alternates by hand, as Designer Tools was unable to generate an alternate (The relative virtual path 'Orchard.Core.Shapes.CoreShapes::Zone' is not allowed here)
Basically - I cannot figure out how to style the content found on a specific page, (Title, Tags, Date, Body) as the Content always seems to inheirit from the base shape.
If your point is to style content in a zone, u might find it easier to use css. The layout system makes it really easy to identify the elements your interested in styling by using css selectors.
for example
.aside1.news { ... }
That takes care of 80% of styling needs
Most of the remaining is taken care of by the placement.info file which allows you to indicate which fields and what order for contenttypes and viewstypes (summary and detail)
the remaining needs are address by overriding the contentitem.view.
But you seem to indicate that you want to set the style for a contenttype in a specific zone for a url. So... You have the same contentType in different zones at the same url? I cannot imagine what you are doing. :)
Long and short, it sounds like your focused on the zone but it might be more helpful to focus on the contenttype or better yet, css. I ran into the same thing with url alternates suggesting alternates that aren't valid. It seems weird that it suggests zone alternates. I don't think those those are allowed.

Resources