Pagination in Big Commerce - Not Pre-Fixing correctly - pagination

I'm using a stencil theme in Big Commerce and am having an issue with the pagination buttons. When I click on the page number or next button, the site prefix is not adding an additional / to the end of the url.
The url should read as follows:
https://example.com/learn-more/?page=2
but clicking the buttons only links back to the main blog page:
https://example.com/learn-more/
I went through the "Store Front > Blog > {...} (settings) > About This Blog" and made sure the blog url was set to the correct format ( i.e.- /blog/ }, but that is not having the correct effect.
I'm gettting familiar with the stencil themes, but I'm lost on how to correct urls in this format, as the normal react fixes are not there...
Please Help

Yeah, same issue here. After playing with the blog settings like you did, I ended up applying a workaround by correcting the URLs via script just to fix it quickly.
const isBlogPostsPage = $('.blogPosts').length > 0;
if (isBlogPostsPage) {
$('.pagination-link').each(function() {
let link = $(this).attr('href');
link = link.replace('/articles?', '/articles/?');
$(this).attr('href', link);
});
}

Related

Sharepoint online navigation caching?

I am using Aplication Customizer to add jQuery and custom javascript to my page:
let current_date: Date = new Date();
let date_String: string = current_date.toString();
date_String = current_date.toISOString()
console.log('date_string = %s', date_String);
SPComponentLoader.loadCss('https://8lbg15.sharepoint.com/sites/KnowledgeBase/SiteAssets/caj23.css?d=' + date_String);
//SPComponentLoader.loadScript('https://8lbg15.sharepoint.com/sites/KnowledgeBase/SiteAssets/jquery-3.6.3.min.js?d=' + date_String)
//SPComponentLoader.loadScript('https://8lbg15.sharepoint.com/sites/KnowledgeBase/SiteAssets/caj23.js?d=' + date_String);
SPComponentLoader.loadScript('https://8lbg15.sharepoint.com/sites/KnowledgeBase/SiteAssets/jquery-3.6.3.min.js?d=' + date_String, {
globalExportsName: 'jQuery'
}).then(($: any) => {
$(function () {
console.log('jQuery is loaded');
});
SPComponentLoader.loadScript('https://8lbg15.sharepoint.com/sites/KnowledgeBase/SiteAssets/caj23.js?d=' + date_String, {}).then(() => {
//...do something
});
});
The code runs fine when I open the page. However, if I navigate to the page from the main site navigation (ie the mega menu) the code doesn't run. Yet if I click on the link a second time in the nav, it loads the page and the code runs.
In other words, it doesn't rung when you change pages via the nav, but if you load the same page (or reload the page with F5) it does!!!
Is this some kind of caching issue? I am using Sharepoint Modern/Online so there is no caching setting for the site.
Any solutions gratefully received.
According to your description, as far as I know, custom code is usually loaded when the entire page is refreshed. And the first time you enter the page via the navigation, the entire page refresh is not triggered, so no code does not take effect.
SharePoint Online works online. If you are worried that the cache has affected this matter, you can try to clear the cache of the browser, or switch to the private mode to see if the problem is resolved.
Seems to be a routing interceptor that will check your link and if appropriate, do a partial navigation, ie avoiding a full page load.
To work around and force javascript to run, add
data-interception="off"
to all links eg by script
$('a').attr("data-interception", "off");

How to display all images from a blog article

I am trying to display all the images from a blog article in the blog listing page.
Currently it only displays the image marked as preview in the shopware backend > blog article configuration > Image configuration. But I also need to display the others if you select more than one.
I have been trying to modify the box.tpl file from the blog folder, the detail.tpl, and even the Blog.php file under Shopware > Controllers > Frontend but didn't have luck.
In the Blog.php file under the index method I saw this piece of code but not sure if this one does the trick
//adding thumbnails to the blog article
if (empty($blogArticle['media'][0]['mediaId'])) {
continue;
}
$mediaId = $blogArticle['media'][0]['mediaId'];
if (!isset($medias[$mediaId])) {
continue;
}
I am not a shopware expert so any tip would be appreciated.
Thanks.
You would need to write your own plugin and override the index method of the Blog Controller.
You can take a look at the Blog Controller's detailAction how to get all media images.
In your above example you're just getting the first image with [0], but you would need to loop trough all images like in the detailAction.
You may also have a look at the Shopware developer video trainings on Udemy and the Shopware developer documentation.

Kentico 9 blog main page, archive page, and tag page

I'm new to Kentico, and have spent hours trying to make the blog work but haven't had any luck. Hope someone could help. I created a new blog by [a] using Pages > New Page > Blog; [b] then applying the Blog page template to it; [c] after that I created 2 sample blog posts. The only thing that works is the individual blog post. Other things don't work:
1- the blog main page --> empty
2- the blog archive page (for July) --> empty
3- tag link --> error message "Page /Blogs/My-blog-1.aspx was not found." Although I know I can change the tag link url, not sure what should be in there.
4 - making "Blog" appears on my nav (that I used CSS List menu web part). For this one, as a workaround, I was thinking about adding a blank "Blog" page and had it redirected to the blog url.
I've read the documentation related to Blog, but couldn't make it to work. Thanks for help!
Some of the out of the box templates are setup in such a way to only work on some of the example site templates which is why you're getting these results.
In the rptAllPosts repeater, set the Path property to ./%, ensure the Page types property is set to cms.blogpost, make sure you have a value in the Transformation property as well.
Should be resolved when you finish #1
You will have to modify the Selected Transformation. If you're using the default transformation, about line 9, way at the end you will need to modify the last parameter from ~/Blogs/my-blog-1.aspx to ~/Blog. This should fix the blog tag link.
Your work-around is very common and I'd stick with it for now.

Liferay: How to fetch the first 3 items from an asset publisher?

In Liferay I have used the asset publisher to publish news on my news page. I want to fetch the 3 top news from the page and embed it into another page. How can I do this? The page URL containing the news links looks like the following:
Liferay.Widget({ url: 'http://test.com/testnews/101_INSTANCE_f22'});
Liferay itself has a property where one can share an asset publsiher instance any where else on a site, but that is not exactly what I want. So any help or guidance is appreciated. Thanks.
If you want only links then you can set display style 'title-list' (this will take you to the article on the main news page).
if you want to open the link in another page, change asset link behavior to 'View in a specific portlet'.
You can change the look of asset publisher to whatever design you want. follow the path look & feel --> advanced styling --> Copy the portlet id. Now by using mozilla firefox pick the class,tags,etc. and write your css code. This will override the basic design. E.g.
#p_p_id_101_INSTANCE_8f5JPIxv8ml0_ .asset-abstract {
width: 25%;
float: left;
}
Is there a particular reason why you don't want to configure another AssetPublisher on the second page? You can just use the identical configuration, but limit the number of results shown to 3 - done.
Problem solved. Here is the solution with jQuery:
$.get('http://test.com/news/', function(data) {
var top3links = $(data).find('a:lt(3)');
$('#top3').html(top3links); // });

Jump to URL doesn't work

I have a report that contains a link to a Word document. I have created an Action on the textbox that is Jump to URL, with the URL populated.
I have a PerformancePoint dashboard displaying the report, which is in a report library using SharePoint Integrated reports.
The link is not working correctly. Following the recommendations of this guy I surrounded my link w/ the javascript to open in a new window.
This works everywhere except for the end result. The link works from BIDS, Dashboard Designer, and the Report Library. It does not work from within the dashboard deployed to the SharePoint site. Any ideas?
Edit:
This HTML link:
=First(Fields!Link.Value, "MyUrl")
gives me this in the rendered report:
<TD style="WIDTH:53.98mm;word-wrap:break-word;HEIGHT:6.35mm;" class="a7">Click Me!</TD>
This Javascript link:
="javascript:window.location.href='" & First(Fields!Link.Value, "MyUrl") & "';"
gives me this in the rendered report:
<a tabindex="40" href="javascript:window.location.href='http://example.com/sites/some/subsite/DocumentLibrary/Folder/MyDocument.doc';" style="color:Blue" TARGET="_top">Click Me!</a>
Which does nothing when you click it.
I'm not familiar with Performancepoint, but the way you write the javascript seems like you simplified it a bit? I'm asking because the only way that perfectly fine link would not work would be if the page has a return false for the links in it. Try moving the whole changing the URL into a function, like:
<script type='text/javascript'>
function goTo(url) {
window.event.stopPropagation(); // cancelBubble() in IE
location.href = url;
return false;
}
</script>
with the link being:
="javascript:goTo('" & First(Fields!Link.Value, "MyUrl") & "')"
and do some trial and error inside the goTo function, sorry not being able to help you more precisely. Try also testing in a second browser (if you are not already) to see if this is some browser-specific behavior.
It turns out that there were two issues going on.
My first attempt at rendering a link using https://example.com/... didn't work because Reporting Services 2005 refuses to link to https web sites. (no source for this info, just determined through experimentation)
My second attempt at putting javascript around the link failed because PerformancePoint 2007 dashboards don't execute JavaScript from a report. (no source for this info, just determined through experimentation)
The solution was to go back to a straight HTML solution, and use http. This gets redirected to https and the document loads. This solution may not work if your environment does not automatically redirect http --> https.
I didn't mention the https in my original question because I didn't realize that would make a difference.

Resources