<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Get specific section or text from URL with request.query in CMS Development</title>
    <link>https://community.hubspot.com/t5/CMS-Development/Get-specific-section-or-text-from-URL-with-request-query/m-p/419417#M21795</link>
    <description>&lt;P&gt;&lt;SPAN&gt;I need to pass the last section of a URL into a HUBL dictionary.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I can do this by:&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set URL = request.query %}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;And then setting {{URL}} to a dictionary value like so.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{% set myPlatform = [
{
'name': 'UNIVERSAL macOS/WINDOWS',
'platform': 'Universal',
'description': 'License works on macOS or Windows',
'paddleProductId': 12345,
'coupon': '{{URL}}'
},&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;This will give me the all the text after the first backslash in the URL&lt;BR /&gt;&lt;BR /&gt;Now, what I need to do, for example, is when someone goes to&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://mysite.com/coupon=COUPONCODE" target="_blank" rel="noopener noreferrer"&gt;mysite.com/coupon=COUPONCODE&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;I need to figureout how to get whatever just the COUPONCODE text may be so I can apply that as variable for the dictionary value.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I could do this with JS:&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let couponString =
window.location.href.substring(window.location.href.lastIndexOf('/') + 1);
let couponCode = couponString.replace('coupon=', '');&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;But then I'm not sure how to pass the {{URL}} variable here to grab the specific text I need.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Mar 2021 12:56:59 GMT</pubDate>
    <dc:creator>ckingg</dc:creator>
    <dc:date>2021-03-17T12:56:59Z</dc:date>
  </channel>
</rss>

