BigCommerce Stencil Custom Page template not appearing - bigcommerce

In Page Builder I've added a page called About Us which has the url '/about-us/'
I've been following the instructions found here
https://developer.bigcommerce.com/stencil-docs/storefront-customization/custom-templates
in order to make a custom template for that page.
I made a file called about-us.html in templates/pages/custom/page with the contents:
<h1>About Us Page Test</h1>
My .stencil file looks like the following
{
"normalStoreUrl": "my url",
"accessToken": "my access token",
"port": "3003",
"customLayouts": {
"brand": {},
"category": {},
"page": {
"about-us.html": "/about-us/"
},
"product": {}
}
}
I've stopped and reran 'stencil start' but every time I visit localhost:3003/about-us/ it just shows the normal page instead of the custom template I build.
Is there something I'm missing? Is this an issue with using the page builder in combination with stencil?

I assume you haven't set the custom template for your page yet.
Go to Web Pages and edit your About Us page then look for the Template Layout File dropdown. Your custom template should appear there if it is setup correctly.

The issue was resolved when a full system reboot was performed. I'm not sure why stopping and restarting stencil did not resolve this.

Related

Shopify - Modify Page Template & Sections Reference For Custom Page

I am attempting to modify a specific route/template in my Shopify theme, however nothing from examples I have seen or the documentation seems to take.
Currently I have created a page in the Shopify Admin team which is auto assigned to the route /pages/team-page.
In my templates directory I have tried creating different variations as to assign it a custom section such as
team.json
team_page.json
page.team.json
page.team_page.json
And within those json files referenced to my sections directory liquid file custom.liquid with the following:
{
"sections": {
"custom": {
"type": "custom",
"settings": {}
},
"order": [ "custom" ]
}
But to no avail it always references back to the template index.json which renders main.liquid from sections.
Attempting to print out the page.handle returns team-page, while page.template_suffx seems to return nothing.

Can't load index page

I am trying to load my index page, I am using Swig template engine and Express. I get this error:
{
"message": "Failed to lookup view \"/front/index\" in views directory \"/home/ubuntu/workspace/asset-management/server/views\"",
"error": {
"view": {
"defaultEngine": "html",
"ext": ".html",
"name": "/front/index",
"root": "/home/ubuntu/workspace/asset-management/server/views"
}
}
}
But it doesn't make sense unless I am missing something because the file path is this:
/asset-management/server/views/front/index.html
the /views/front/index.html should be correct based off the error right? What am I missing here? I can get other files to work in directories other than front. I have tried copying the part of the path needed into my route.
Route:
// homepage and dashboard
app.get('/',
setRedirect({auth: '/dashboard'}),
isUnauthenticated,
setRender('/front/index'),
main.getHome);
Ignore the most of the middleware and look at the setRender as that is what is equivalent to res.render()
You've got an extra slash that shouldn't be there.
This:
setRender('/front/index'),
should be this:
setRender('front/index'),

Universal Links iOS 9 - Issue

I have implemented Universal links in iOS app. It works perfectly when I put the url in external app such as "Notes" and then tap it. It opens the app.
What I want to achieve is that when someone visits a specific url of my webpage, the ios app should be launched by itself. So in order to accomplish this, I have put:
applinks:www.mydomain.com
in my entitlements.
And the following in my "apple-app-site-association" file
{
"applinks":
{
"apps": [ ],
"details":
[
{
"appID": "team_id.com.teamname.app_name",
"paths": ["/path-CompA/path-CompB/"]
}
]
}
}
But When I navigate through my website, and I reach the path mentioned in json file, it only shows the bar at top of web page saying "Open in App_name" with "Open" button on right side.
I want to know if its the default behaviour of Universal links to not open the app if user is coming from the same domain? If its not the case then how does it open the app form "Notes".
Please note that my json file is not signed but I have put it on my website which is on https.
Thanks,
A couple of things. Can you try changing your apple-app-site-association file code as such?
{
"applinks": {
"apps": [],
"details": [
{
"appID": "team_id.com.teamname.app_name",
"paths": [
"*",
"/"
]
}
]
}
}
You can check your format with this validation tool: https://search.developer.apple.com/appsearch-validation-tool/
The answer is that basically, this behavior is expected as of iOS9.2, with Universal links. Universal links only work from a different domain.
With Branch (https://branch.io/), you can use one domain for links (bnc.lt), so that when you (as a developer using branch) host universal links on your site, they still operate as expected.
Also, for universal links from other domains (not to the same domain), you can 'unbreak' the safari redirect behavior by long-pressing on the link from an application and choosing 'Open in «App»'. I hope this helps!

how to use dojo within a chrome extension?

I want to use dojo within a chrome extension's content script. I have this in my manifest.json:
"content_scripts":[
{
"js":["lib/dojo/dojo.js","main.js"],
"matches":["<all_urls>"],
"run_at": "document_idle"
}
]
I've already put a dojo folder under "lib" folder of the root of this extension. However, the script paused execution and told me dojo is undefined. This means dojo is not loaded.
then i tried register dojoConfig before dojo.js is loaded:
"content_scripts":[
{
"js":["env.js",
"lib/dojo/dojo.js",
"main.js"],
"matches":["<all_urls>"],
"run_at": "document_idle"
}
],
in the env.js, it contains;
dojoConfig = {
"baseUrl" : "/lib/dojo"
};
still not work though. Anyone else has sucessful experience?
According to http://code.google.com/chrome/extensions/content_scripts.html
These are injected in the order they appear in this array.
Maybe your should have to change the js files list order

Chrome Extensions and loading external Google APIs Uncaught ReferenceError

Right now I'm in the process of creating a Chrome extension. For it, I need to use Google's Calendar Data API. Here is my manifest.json file:
{
"name": "Test",
"version": "1.0",
"background_page": "background.html",
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["jquery.js", "content_script.js"]
}
],
"permissions": [
"tabs", "http://*/*"
]
}
I've tried adding the following to the js part of the manifest file but that throws an error when loading the extension.
http://www.google.com/jsapi?key=keyhere
I've also tried adding
document.write('<script type="text/javascript" src="http://www.google.com/jsapi?key=keyhere"></script>');
to my background.html file. However, whenever I call
google.load("gdata", "1");
I get an error that says Uncaught ReferenceError: google is not defined. Why is my extension not loading this api when it loads the other ones fine?
You can't include external script into content_scripts.
If you want to inject <script> tag using document.write then you need to mask slash in a closing tag:
document.write('...<\/script>');
You can include your external api js into background page just as usual though:
<script type="text/javascript" src="http://www.google.com/jsapi?key=keyhere"></script>
If you need this api in content scripts then you can send a request to your background page and ask it to do API-dependent stuff there, and then send a result back to your content script.
Thanks for that link, it helped a lot. However, now I've run into another interesting problem.
for (var i = rangeArray.length - 1; i >= 0; i--) {
var myLink = document.createElement('a');
myLink.setAttribute('onclick','helloThere();');
myLink.innerText ="GO";
rangeArray[i].insertNode(myLink);
}
Now I get the error, "helloThere is not defined" even though I placed that function about ten lines above the current function that has the above loop in the same file. Why might this be happening? And if I do:
for (var i = rangeArray.length - 1; i >= 0; i--) {
var myLink = document.createElement('a');
myLink.setAttribute('onclick','chrome.extension.sendRequest({greeting: "hello"}, function(response) { });');
myLink.innerText ="GO";
rangeArray[i].insertNode(myLink);
}
I get Uncaught TypeError: Cannot call method 'sendRequest' of undefined
This is because there is some syntax error in your code. I had same problem. I opened my background.html page in fire fox with fire-bug plug-in enabled. Fire-bug console should me the error, I fixed and it is working now.