CMS Development

VYadav7
Member | Elite Partner
Member | Elite Partner

Page Redirection

SOLVE

this url is not redirecting to respective url please help me out

 <div class="container" id="tab3C">
<div class="portfoliolist" id="whitepapers_portfoliolist">
{% for row in hubdb_table_rows(5311014, "status=Published&orderBy=-hs_created_at") %}
{% set sentence_whitepapers_title = row.whitepapers_title %}
{% set sentence_all_offerings = row.all_offerings %}
{% set sentence_all_industry = row.all_industry %}
<div class="whitepapers-hide mix portfolio all-offerings all-industry {{sentence_all_offerings.name|lower|replace(' ', '-')|replace(' ', '')}} {{ sentence_all_industry.name|lower|replace(' ', '-')|replace('-&-', '-')}} {{ sentence_whitepapers_title|lower }}" data-filter-item data-filter-name="{{ sentence_whitepapers_title|lower }}">
<div class="portfolio-wrapper">
{% if row.whitepapers_image %}
<img src="{{ row.whitepapers_image.url }}" alt="{{ row.whitepapers_title }}">
{% else %}
<img src="{{ get_asset_url('../images/resources-image.png') }}" alt="Image" />
{% endif %}
<div class="label">
<div class="label-text">
<div class="text-title match">{{ row.whitepapers_title|truncatehtml(80, '...' , false) }}</div>
<div class="text-description">{{ row.whitepapers_description|truncatehtml(90, '...' , false) }}</div>
<div class="view-link">
{% if row.is_it_gated.name== 'Yes' %}
<a href="{{ domain }}/download-whitepapers/?redirect={{ domain }}/whitepapers/{{ row.hs_path }}" class="text-link gettedform" target="_blank">Download</a>
{% else %}
<a href="{{ domain }}/whitepapers/{{ row.hs_path }}" class="text-link" target="_blank">Download</a>
{% endif %}
</div>
</div>
</div>
</div>
</div>
{% endfor %}
<div class="load-more-button" style="display: none;">
<a href="javascript&colon;void(0)" class="whitepaper-load-more button">Load More</a>
</div>
</div>
</div>

0 Upvotes
2 Accepted solutions
piersg
Solution
Key Advisor

Page Redirection

SOLVE

Have you set {{ domain }} somewhere in your code that you haven't copy pasted here? If not, it's not a valid HubL variable, you need {{ request.domain }} and you need to add the protocol to it, e.g.

href="https://{{ request.domain }}/download-whitepapers?redirect={{ request.domain }}/whitepapers/{{ row.hs_path }}"

 

Are you reading the "?redirect" url parameter with JS and doing something with it based on some event e.g. form submission?

View solution in original post

VYadav7
Solution
Member | Elite Partner
Member | Elite Partner

Page Redirection

SOLVE

I have used this code and it works fine

<script>
hbspt.forms.create({
region: "na1",
portalId: "2466330",
formId: "{{ module.download_assets_form_id }}",
inlineMessage: 'This page is redirecting...',
onFormSubmit: function($form){
setTimeout( function() {
window.location = "{{ request.query_dict.redirect }}";
}, 250 );
}
});
</script>

View solution in original post

0 Upvotes
3 Replies 3
VYadav7
Solution
Member | Elite Partner
Member | Elite Partner

Page Redirection

SOLVE

I have used this code and it works fine

<script>
hbspt.forms.create({
region: "na1",
portalId: "2466330",
formId: "{{ module.download_assets_form_id }}",
inlineMessage: 'This page is redirecting...',
onFormSubmit: function($form){
setTimeout( function() {
window.location = "{{ request.query_dict.redirect }}";
}, 250 );
}
});
</script>

0 Upvotes
piersg
Solution
Key Advisor

Page Redirection

SOLVE

Have you set {{ domain }} somewhere in your code that you haven't copy pasted here? If not, it's not a valid HubL variable, you need {{ request.domain }} and you need to add the protocol to it, e.g.

href="https://{{ request.domain }}/download-whitepapers?redirect={{ request.domain }}/whitepapers/{{ row.hs_path }}"

 

Are you reading the "?redirect" url parameter with JS and doing something with it based on some event e.g. form submission?

dennisedson
HubSpot Product Team
HubSpot Product Team

Page Redirection

SOLVE

@piersg , what are you thoughts on this redirect mayhem? 😎

0 Upvotes