Posts

Showing posts from July, 2023

Sitecore JSS - Nextjs - Redirect problem using "router.push" with url that contains query

 This wont be a solution for a problem, but will be a inner discussion about some things that doest work. If I found a proper solution, I will update the post and add the solution once I found it. I will add the resources found that I think are usefull. To understand the problem. router . push ({ pathname : props . fields . viewInternalCta . value . href }); Not sure if it is the best implementation we can get. But when try to use a Url that contains paramenters like /Search/Blogs/result?types=news&q= The main problem with this implementation is the URL came from a Sitecore GeneralLink as a External link. The nextjss "router.push" allow to call URL query, but it must be implemented in that way. The problem with "General Link" contains a link to an object internal or external. In case we use a external link we can put there any link we want. In this example I use a link like: /Search/Blogs/result?types=news&structure= But when router.push tries to resolve t...

Sitecore JSS Common problems - Visual Studio Code - "JSX element implicitly has type 'any' "

 Sometimes we got some strange errors for VisualStudio and Visual Studio Code. I got the  "JSX element implicitly has type 'any' " , an error that make a RED underline over all the code into the component we are developing. It appears to be related to a change into the components dependency  for the current NodeJSS project. The solution it appears to be easy. It is reloading VSCode. You can do it following the next steps: Ctrl + Shift + P  - or -  ⌘ + shift + P And type: Developer: Reload Window Probably will work closing VSCode and open the project again too. The original solution was found in Stackoverflow: https://stackoverflow.com/questions/37674017/how-to-solve-jsx-element-implicitly-has-type-any-error

Sitecore Content Editor - Modify a Treelist source from 1 template to 2 templates

 Original Source: datasource=/sitecore/content/pmdt-jss-site&allowmultipleselection=yes&includetemplatesfordisplay=Folder,LeftMenuItem-TemplateCard&includetemplatesforselection=LeftMenuItem-TemplateCard New Source: datasource=/sitecore/content/pmdt-jss-site&allowmultipleselection=yes&includetemplatesfordisplay=Folder,LeftMenuItem-TemplateCard,LeftNavChilds-TemplateCard&includetemplatesforselection=LeftMenuItem-TemplateCard,LeftNavChilds-TemplateCard I am developing in sitecore. And tell me as a sitecore expert: I will modify the template, a field type Treelist with source that now contains: datasource=/sitecore/content/pmdt-jss-site&allowmultipleselection=yes&includetemplatesfordisplay=Folder,LeftMenuItem-TemplateCard&includetemplatesforselection=LeftMenuItem-TemplateCard and i want to support no only: LeftMenuItem-TemplateCard i want to support another template too: LeftNavChilds-TemplateCard what must be the new source for this: To support a...