This was all about Scenario's which I involved in my profession.
Tuesday, 23 February 2021
Thursday, 14 January 2021
Sitecore | SXA | Access Drop link and link field items in Scribban
- Droplist type
- {{sc_raw i_item "fieldName"}}"
- Droplink (one child item)
- We can get the item and then read value from child item:
- {{- childitem=sc_follow i_item "fieldName" -}}
- {{sc_raw childitem "childItemfieldName"}}"
- we can read Inline with the below:
- {{sc_follow i_item "fieldName" | sc_raw "childItemfieldName"}}
- Tree link (multiple sub child items)
- We can get all items as a collection
- {{for i_child in (sc_followmany i_item "fieldName") }}.
Thursday, 17 December 2020
How to create new custom theme SXA Sitecore
1. Open website local root on your local machine and open the route C:\inetpub\wwwroot\sc93sc.dev.local\App_Config\Include\z.Feature.Overrides and enable config file..
2. Navigate to folder under theme created on Local machinne and open command terminal on Visual studio code and run: 'npm config set `@sxa:registry https://sitecore.myget.org/F/sc-npm-packages/npm'
3. After registering nuget packages url, on the same root run : 'npm install -global @sxa/CLI'
4. Run this command to allow remote machine url to register url: 'Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine'
I ran this on my local machine
5. And then run this command to register url: sxa register https://sc93.sc.local/
((""Inorder to create a new theme we need to run 'new "Themename"' after above command on theme folder))
6. Navigate actual theme location folder (C:\repos\CustomappTheme\-\media\Themes\Corporate\Customapp\COMBank> npm install) and run : 'npm install'
This will install all required npm modules to our theme
7. Run this command on above root : 'SXA rebuild'
8. And then run gulp on the same root : 'gulp'
9. Command to run to publish UI changes to Sitecore Instance : 'sxa watch All -d'
New setup for CE:
master sitecore 7
but no need to run gulp sxa rebuld
. Navigate actual theme location theme folder (Customapp> npm install) and run : 'npm install'
This will install all required npm modules to our theme
. Run this command on above root : 'SXA rebuild'
. Command to run to publish UI changes to Sitecore Instance : 'sxa watch All -d'
Tuesday, 17 November 2020
Monday, 3 August 2020
How to open pdf in browser instead of downloading in sitecore site
I am using the below patch configuration file for Sitecore 9x and SXA 1.8 to stop the download of PDF files. It works fine for me
<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<!-- Force download of PDF files -->
<mediaLibrary>
<mediaTypes>
<mediaType name="PDF file" extensions="pdf">
<forceDownload>false</forceDownload>
</mediaType>
</mediaTypes>
</mediaLibrary>
</sitecore>
</configuration>
Wednesday, 22 April 2020
How to Check if element is visible after scrolling?
jQuery.extend(jQuery.expr[':'], {
inview: function (elem) {
var t = $(elem);
var offset = t.offset();
var win = $(window);
var winST = win.scrollTop();
var elHeight = t.outerHeight(true);
if ( offset.top > winST - elHeight && offset.top < winST + elHeight + win.height()) {
return true;
}
return false;
}
});
$(".my-elem:inview"); //returns only element that is in view
$(".my-elem").is(":inview"); //check if element is in view
$(".my-elem:inview").length; //check how many elements are in view
Tuesday, 10 September 2019
Pull to refresh javascript
To implement pull to refresh functionality in your website follow the below steps:
- add script reference in your layout (https://www.cssscript.com/demo/easy-pull-to-refresh-library-with-pure-javascript-pulltorefresh-js/pulltorefresh.js)
- add below style in the layout (<style>.ptr--ptr { box-shadow: inset 0 -3px 5px rgba(0, 0, 0, 0.12); pointer-events: none; font-size: 0.85em; font-weight: bold; top: 0; height: 0; transition: height 0.3s, min-height 0.3s; text-align: center; width: 100%; overflow: hidden; display: flex; align-items: flex-end; align-content: stretch; } .ptr--box { padding: 10px; flex-basis: 100%; } .ptr--pull { transition: none; } .ptr--text { margin-top: .33em; color: rgba(0, 0, 0, 0.3); } .ptr--icon { color: rgba(0, 0, 0, 0.3); transition: transform .3s; } .ptr--release .ptr--icon { transform: rotate(180deg); }</style>)
- add below code in the layout under script tag ( PullToRefresh.init({ mainElement: '#main'})
Subscribe to:
Posts (Atom)
Extracting Nupkg files using command line
Rename it to zip first then extract files as below 1. Rename-Item -Path A_Package.nupkg -NewName A_Package.zip 2. Make sure to repla...
-
In this exercise we will create a new feature module in our solution. Modules are a conceptual grouping of all assets related to a sin...
-
Adding something to the first item in a loop. As an example, below adding the active class to a bootstrap element, useful for tabs, menus...
-
Getting-started Bootstrap Components Grid Positioning