Skip to content

Instantly share code, notes, and snippets.

@xlawok
Created June 1, 2022 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xlawok/afa726f46bee3ddff66875ff8a483c1d to your computer and use it in GitHub Desktop.
Save xlawok/afa726f46bee3ddff66875ff8a483c1d to your computer and use it in GitHub Desktop.
Presta - pagination with ajax load - add pagination No to title and h1
<script type="text/javascript">
{literal}
window.setTimeout(function(){
// on click refresh variables
var awgeturl=window.location.href;
var awgeturl= awgeturl.split('#/page-')[1];
var content = " - strona "+awgeturl;
var theh1=document.querySelector('#category h1.aw-category');
var thetitle=document.title;
// replace old " - strona XX" string with new
var category_a= (theh1.innerHTML).split(' - strona ');
category_a[1]=" - strona " + awgeturl;
var title_a= thetitle.split(' - strona ');
title_a[1]=" - strona " + awgeturl;
if(typeof awgeturl!="undefined"&&awgeturl!="1"){
theh1.innerHTML =category_a.join('');
document.title = title_a.join('');
}
else{
theh1.innerHTML =category_a[0];
document.title = title_a[0];
}
console.log(awgeturl)
}, 1000);
{/literal}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment