All Content
Timespan
explore our new search
Generating GUIDs & Base URLs: Top 2 Liquid Tips from Power Pages
Image Source: Shutterstock.com
Power Pages
Sep 30, 2023 7:24 AM

Generating GUIDs & Base URLs: Top 2 Liquid Tips from Power Pages

by HubSite 365 about Pieter Veenstra [MVP] (SharePains)

Microsoft MVP and Microsoft Productivity Principal Architect at HybrIT Services

Citizen DeveloperPower PagesM365 Hot News

Unravel the mysteries of Power Pages development with two Liquid tips - learn to generate GUIDs and base urls seamlessly!

Power Pages Development: 2 Liquid Tips for Generating GUIDs and Base URLs

In this summarized blog by "Pieter Veenstra [MVP] (SharePains)", he discusses the Power Pages development process focusing on the generation of GUIDs and the base URLs for site enhancement. He targets those with a basic understanding of technologies including HTML, CSS, JavaScript, Dataverse and Liquid.

Veenstra underscores the challenges associated with power development and highlights two quick tips that can potentially simplify the process. The first tip, as he mentions, revolves around getting your Power Pages URL which can be quite useful in deploying to different environments.

The author presents this insight in relation to code rewriting. He refers to a scenario where an initial base URL changes after being deployed to a different environment. Usually, such a change requires drastic edits to pages for uniformity. However, Veenstra provides an alternative - writing your code with a focus on a base URL which doesn't require any page edits, making the process much easier1.

Regarding the second tip, Veenstra advocates for the creation of a unique ID within Liquid. With his background in various languages, he laments the absence of a Guid() function in Liquid, noting it as quite handy for user journey progress records.

Veenstra recounts some solutions that have been used in the past like the use of current date and time. However, he disqualifies this method due to potential synchronization issues arising from multiple users clicking the buttons simultaneously. Instead, he proposes a workaround where a unique ID is generated to pass it on from one page to another, increasing user-friendliness of the site.

This procedure involves creating a unique booking ID, for instance, like a URL on a page calling another, where we want to create a booking. As a result, the system generates a unique ID allowing seamless and trackable user activity in the subsequent pages.

The blog post contains useful tips on how to improve the functionality and efficiency of Power Pages using Liquid. It offers developers solutions to common challenges and enhances their understanding of Power Pages development processes.

General Perspective on Power Pages

Power Pages are becoming a crucial aspect of internet site functionality. The tool's ability to increase user-friendliness and enhance navigation ensures an optimal browsing experience. Developers should continue learning new skills and techniques to improve Power Pages development and creation.

Read the full article Power Pages - 2 Liquid tips – Generate GUIDs and base urls

Power Pages - Generating GUIDs & Base URLs: Top 2 Liquid Tips from Power Pages

Learn about Power Pages - 2 Liquid tips – Generate GUIDs and base urls

In this article, we are going to take a more in-depth look into power pages, focusing on a couple of useful liquid tips - generating GUIDs and base URLs. With the rapid advancement of technology, Power Pages have become an important tool for developers to construct robust and interactive sites. However, leveraging their full potential may pose a challenge for many. Therefore, getting acquainted with certain technologies can serve beneficial, these include HTML, CSS, JavaScript, Liquid and Dataverse.

If you are already well-versed with the aforementioned and looking forward to using Power Pages efficiently, we have some tips that can make the process simpler.

Tip 1 – Identifying the URL
It's not uncommon for your link to look like the following : <a href="https://myppsite.powerpages.com/paymentinvoice">Place Order</a>. However, once deployed to a different environment, the base URL changes, which would be an issue, especially if you have multiple pages with such links.

This can be resolved by re-writing your code and incorporating a base URL, like <a href="{{baseurl}}/paymentinvoice"> Place Order </a>. By utilizing liquid filters, it’s relatively simple to get hold of the base URL. All it needs is a one-liner like {% assign baseurl = request.url |split: request.path | first %}.

Tip 2 – Creating a unique ID
Another crucial aspect while working with Liquid is the occasional requirement to generate a unique guid. Sadly, a function to create a guid, akin to several other languages, is not available in Liquid.

To overcome this challenge, an interesting application of AI, as well as some Liquid logic is used, giving us a GUID conforming to the standard GUID format. This can be achieved as follows: &bookingid={% for character in 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx' %} {%if character =="x" %} {{'01234567890abcdef'| shuffle | first }}{% endif %} {%if character != "x" %} {{character}} {% endif %} {% endfor %}"

Working with Power Pages gets increasingly interesting and challenging as the complexity increases. However, with the right guidance and understanding, these challenges can be navigated seamlessly. Therefore, irrespective of where you stand in your journey of Power Pages development, keep exploring, learning and implementing for the best results.

In case, there are more queries or if a topic has been missed out, feel free to reach out. Remember, every problem has a solution, it's just a matter of finding it.

More links on about Power Pages - 2 Liquid tips – Generate GUIDs and base urls

2 Liquid tips - Generate GUIDs and base urls in Power Pages
Apr 25, 2023 — In this post I'm looking at Power Pages and how to get the base url of my site and generate Guids in Liquid.
2 Liquid tips – Generate GUIDs and base urls in Power ...
Apr 25, 2023 — In this post I'm looking at Power Pages and how to get the base url of my site and generate Guids in Liquid.
Solved: Getting started with liquid - Power Platform Community
Jul 23, 2023 — Power Pages will work based on authenticated users. There are different types of logins used in Power Pages. 1. Local Authentication ( will be ...

Keywords

Power Pages, 2 Liquid Tips, Generate GUIDs, Base URLs, SEO, Guid Generation, Liquid SEO Tips, URL Generation, Web Optimization, SEO Power Pages