How to show property of masterpage on a page in Umbraco - templates

I have an umbraco project with a masterpage (with it's own content type) and a homepage underneath it.
The masterpage content type includes stuff like the footer, header etc.
However when I look at the homepage, the properties of the masterpage don't display.
In the masterpage template I have the line:
<umbraco:Item field="footerText" runat="server" />
But this doesn't pull the footerText property from the masterpage properties.
I am guessing it has something to do with the fact that properties are not inherited, so how do we go around that? Writing a simple macro that pulls the data or is there a quicker way?
Many thanks

If you're trying to access fields belonging to a parent node, you would set the recursive attribute to true:
<umbraco:Item field="footerText" recursive="true" runat="server" />
When you are editing your masterpages via the template editor in the Umbraco backend, you can use the "Insert umbraco page field" dialog to help build your tags.

Related

Sitecore 9 - Add an Image to a Link in the Footer

A client is using Sitecore 9 - we are not Sitecore developers.
We've been asked a simple thing: add social media links to the Footer of their Sitecore site.
Its proving more difficult than expected.
I've added the links on other pages by editing the HTML directly via the WYSWIG editor.
But the Footer appears more restricted, only accepting the addition of templates like 'Link'.
The 'Link' template has an option to add an external URL but doesn't have an option to add an image.
The CMS looks like this:
Is there any way to add a link, with an image, via the CMS (without the need to write Sitecore code), so the page chnages from this:
to this:
If you dont want to write Sitecore code, maybe you should think about using frontend.
Find the views that holds the footer (probably Foundation/Footer.cshtml) or something like that.
-To easily find where it is, follow these steps
Go to a content page Presentation Details that has footer (probably any)
Go to Controls
Find the footer rendering in there
Click on it
Grab the Datasource's value
Go to the Datasource's path
There should be a field holding the value of the view.
Add some css class on the div that holds those items, and do your frontend stuff in there...
It is not a scalable solution, so I would highly recommend updating the Footer rendering by adding new fields and adapting the model/view. So that way a content editor could easily add a new value for each socials.

Sitecore Experience editor showing raw JSON data

I am using a simple MVC sitecore project. I just given only one field in rendering page. When i try to view in "Experience Editor" its showing some raw JSON Data like below.
I have used this post
to solve this. when i include that webedit.css in my main layout then the Raw data vanished. But i am not able to see the Editing Ribbon. But when i choose Experience Editor from desktop its showing all Default contents correctly along with the editing Ribbon(Default Page).
Can anyone tell me why i am not able to see that editing ribbon on my page?
This is because your layout razor cshtml file has valid HTML markup skeleton in place. Please make sure at the very minimum your page is formatted like this:
#using Sitecore.MVC
<html>
<body>
#Html.Sitecore().Etc...
etc...
</body>
</html>
This should eliminate the big chunk of JSON on top and enable all page editor UI elements.

Sitecore, Content Editor, not generating links

I am having problem with content editor, I am using tool bar of content editor to generate hyperlinks, following is my HTML
<li>w</li>
<li>a</li>
<li>awealth</li>
<li>wwealth</li>
<li>ds</li>
some items are successfully linked to appropriate files but some links are rendered as they are and when i click on them i see page not found. IDs are valid, I have verified.
What could be the reason, Why some links aren't converted to links to actual files? Any other way to use content editor?
You need to render the field using Sitecore Controls:
<sc:Text runat="server" field="MyFieldName" />
sc:Text derives from the FieldRenderer.
You should consider reading http://sdn.sitecore.net/upload/sitecore6/64/presentation_component_api_cookbook_sc64-a4.pdf (sc:Text is used on page 36)

SharePoint 2013 Can't edit the Content Editor snippet

In SharePoint 2013 it is possible to create master pages and page layouts using the new Design Manager. After converting a HTML file to a masterpage, or after creating a new page layout, one can add SharePoint functionality by using the Snippet Manager. I have used this approach to convert a static HTML/CSS file into an SharePoint masterpage with accompanying page layouts. I'm able to use all the snippets from the Snippet Manager, except for the "Content Editor" snippet. I was able to add top navigation, the quick launch bar, page properties and even "Web Part Zone" snippets.
The usecase:
I want to have a editable footer. The footer consists of four parts, so I added four Content Editor snippets, by pasting the snippet code into the HTML masterpage. When generating a snippet, it's possible to set custom properties. I noticed that it's not possible to set the WebPartID over here. In the snippet, the following WebPartID is always used: 00000000-0000-0000-0000-000000000000. The "Web Part Zone" snippet however will generate a (random?) WebPartID (and works).
The problem:
Adding the snippet works fine, but when I publish the master page or page layout it's not possible to edit the CEWP. When I edit a page which uses either the master page or the page layout, the CEWP should transform to an editable region, but it doesn't. There is no error shown. The webpart renders itself correctly.
What I tried:
I tried filling in a random WebPartID, but that doesn't work. Searching on Google and on StackOverflow didn't gave me any clues, I can't find anyone facing the same problem.
The code:
The following snippet is generated:
<!--CS: Start Content Editor Snippet--><!--SPM:<%#Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>--><!--MS:<WebPartPages:ContentEditorWebPart xmlns:WebPartPages="namespace" runat="server" webpart="true">--><!--PS: Start of READ-ONLY PREVIEW (do not modify)--><div class="ms-webpart-chrome ms-webpart-chrome-fullWidth "><div WebPartID="00000000-0000-0000-0000-000000000000" HasPers="true" id="WebPart" width="100%" class="ms-WPBody noindex " OnlyForMePart="true" allowMinimize="false" allowRemove="false" allowDelete="false" style=""><div class="ms-rtestate-field"></div><div class="ms-clear"></div></div></div><!--PE: End of READ-ONLY PREVIEW--><!--MS:<WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2">--><!--MS:<Title>--><!--SPM:$Resources:core,ContentEditorWebPartTitle;--><!--ME:</Title>--><!--MS:<FrameType>--><!--SPM:None--><!--ME:</FrameType>--><!--MS:<Description>--><!--SPM:$Resources:core,ContentEditorWebPartDescription;--><!--ME:</Description>--><!--MS:<IsIncluded>--><!--SPM:true--><!--ME:</IsIncluded>--><!--MS:<ZoneID>--><!--SPM:ImportedPartZone--><!--ME:</ZoneID>--><!--MS:<PartOrder>--><!--SPM:0--><!--ME:</PartOrder>--><!--MS:<FrameState>--><!--SPM:Normal--><!--ME:</FrameState>--><!--MS:<Height>--><!--ME:</Height>--><!--MS:<Width>--><!--ME:</Width>--><!--MS:<AllowRemove>--><!--SPM:false--><!--ME:</AllowRemove>--><!--MS:<AllowZoneChange>--><!--SPM:false--><!--ME:</AllowZoneChange>--><!--MS:<AllowMinimize>--><!--SPM:false--><!--ME:</AllowMinimize>--><!--MS:<AllowConnect>--><!--SPM:true--><!--ME:</AllowConnect>--><!--MS:<AllowEdit>--><!--SPM:true--><!--ME:</AllowEdit>--><!--MS:<AllowHide>--><!--SPM:false--><!--ME:</AllowHide>--><!--MS:<IsVisible>--><!--SPM:true--><!--ME:</IsVisible>--><!--MS:<DetailLink>--><!--ME:</DetailLink>--><!--MS:<HelpLink>--><!--ME:</HelpLink>--><!--MS:<HelpMode>--><!--SPM:Modeless--><!--ME:</HelpMode>--><!--MS:<Dir>--><!--SPM:Default--><!--ME:</Dir>--><!--MS:<PartImageSmall>--><!--ME:</PartImageSmall>--><!--MS:<MissingAssembly>--><!--SPM:Cannot import this Web Part.--><!--ME:</MissingAssembly>--><!--MS:<PartImageLarge>--><!--SPM:/_layouts/15/images/mscontl.gif--><!--ME:</PartImageLarge>--><!--MS:<IsIncludedFilter>--><!--ME:</IsIncludedFilter>--><!--MS:<ExportControlledProperties>--><!--SPM:true--><!--ME:</ExportControlledProperties>--><!--MS:<ConnectionID>--><!--SPM:00000000-0000-0000-0000-000000000000--><!--ME:</ConnectionID>--><!--MS:<ID>--><!--SPM:g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911--><!--ME:</ID>--><!--MS:<ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</ContentLink>--><!--MS:<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</Content>--><!--MS:<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor">--><!--ME:</PartStorage>--><!--MS:<ID>--><!--SPM:g_a4deccb6_9661_415d_99c8_51f528cf7428--><!--ME:</ID>--><!--ME:</WebPart>--><!--ME:</WebPartPages:ContentEditorWebPart>--><!--CE: End Content Editor Snippet-->
This generates the following code in the .master file:
<WebPartPages:ContentEditorWebPart runat="server" webpart="true" __WebPartId="{B2063517-7C26-4084-AA28-36434C760CDB}"><WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"><Title>$Resources:core,ContentEditorWebPartTitle;</Title><FrameType>None</FrameType><Description>$Resources:core,ContentEditorWebPartDescription;</Description><IsIncluded>true</IsIncluded><PartOrder>0</PartOrder><FrameState>Normal</FrameState><Height /><Width /><AllowRemove>false</AllowRemove><AllowZoneChange>false</AllowZoneChange><AllowMinimize>false</AllowMinimize><AllowConnect>true</AllowConnect><AllowEdit>true</AllowEdit><AllowHide>false</AllowHide><IsVisible>true</IsVisible><DetailLink /><HelpLink /><HelpMode>Modeless</HelpMode><Dir>Default</Dir><PartImageSmall /><MissingAssembly>Cannot import this Web Part.</MissingAssembly><PartImageLarge>/_layouts/15/images/mscontl.gif</PartImageLarge><IsIncludedFilter /><ExportControlledProperties>true</ExportControlledProperties><ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID><ID>g_2bfa6a66_54d1_45e6_84e7_ebbb461f2911</ID><ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" />
<Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[]]></Content>
<PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /><ID>g_a4deccb6_9661_415d_99c8_51f528cf7428</ID></WebPart></WebPartPages:ContentEditorWebPart>
Some more information:
I'm pasting the snippets in the HTML file, as indicated. When I add a Web Part Zone snippet, I'm able to add working "Content Editor" WebParts in it. "Web Part Zone" snippets are only available in the Page Layout Snippet Manager though, so I can't use that as a workaround to get the footer in the masterpage to work.
My questions:
How can I add a Content Editor WebPart through the Snippet Manager?
Are there others facing the same problem?
Is it okay to leave the WebPartID 00000000-0000-0000-0000-000000000000?
Having fought a bit with SharePoint on this, this is what I found:
There are two different ways the Snippets created by the Snippet Manager work. If they are put anywhere within the html code of your Masterpage or Page Layouts, they will have the exact same configurations as the ones you select on the Snippet Editor, and you won't be able to edit them afterwards.
However, if you put them inside a Webpart Container Snippet code, you will be able to edit the webparts when accessing the Edit Page feature on SharePoint. As you probably figured out, this only works on page layouts and not on masterpages.
I believe a way to have a dynamic footer, is to use a Content By Search Web part and point it to a specific List (Footer List) and on that list you can have a column with a Rich Text Editor type, and then you can create a specific Display Template that will render the list content as desired.
Hope it makes some sense.

Blogger, tumblr option for custom template

How these application allow users to upload their own templates? How is this possible?
Do they have some kind of a their own template engine or..?
Tumblr gives you two options to include your own theme:
If it is just for personal use: by changing the html of the theme. If you go to your tumblr-website and click on the customize button, you can edit the html. In the header file the content of your .css must be pasted between the <style type="text/css"> </style> tags. And you can add some javascript there. For the html I suggest to read the manual that Mirko Adari suggested: Tumblr Theme manual
If you want it to be a theme on itself: submit your theme to the Theme Garden: Tumblr Theme Garden
Blogger is a bit more rigid. Also there you can change your html file. Keep in mind that it's markup for posts is different then Tumblr. Also custom CSS files can be added (more information on that). If you are less familiar with css and html Blogger offers some buttons so that you can change the basics to your own needs. Blogger also offers a way to backup and restore your theme. A more detailed explanation can be found here. This template file must be an .xml file. More information on the markup of this xml-template can be found here.