Sveltekit slug in the rootfolder and build static site - slug

I have the following structure inside my routes folder
+ Angststoornis
+ Doelgroep
+ Prijs
+ Selectief-mutisme
[locationName].svelte
index.svelte
Where the [locationName] slug is dealing with the localized landing pages (for example https://domain.be/gent, where gent is the name of a local city). Another route is for example (https://domain.be/Selectief-mutisme) This route should not be handled by the [locationName] slug, but by /Selectief-mutisme/index.svelte. Let's call these "hard coded" routes
With my development setup everything works great. However when i try to build my site with the static adapter it crashes on the fact that it tries to build /Selectief-mutisme on the [locationName] slug route instead of /Selectief-mutisme/index.svelte. Some hard-coded routes are getting exported correctly but now I can't seem to overcome the /Selectief-mutisme route.
I have tried renaming the [locationName] slug to [zLocationName] because the documentation mentions that dynamic routes are being checked alphabetically if there are multiple options available. But to no avail. (https://kit.svelte.dev/docs#routing-advanced-fallthrough-routes)
Does anyone in here has an idea how to solve this?

Related

Dynamic Subdomain Routing With NextJS

How can the Dynamic Sub domain routing feature be implementing in NextJS?
Example: If a user comes with username abc in site xyz then he can access his
site on abc.xyz.com
Also, if the user have abc.com domain then he can point abc.com to abc.xyz.com
So in future if someone opens abc.com then abc.xyz.com is served. And in URL
also the abc.com is shown.
I have investigated few plugin in NPM like vhost and wildcard-subdomains but not sure that is right way to take on this issue.
The vhost requires changes in system hosts in local system and wildcard-subdomain solves the issue purely with routing.
The Local System Setting I have customized Server.js With Code Which Works Temporarily, but does't seems to be a solution which can be used in production :
Server.js
...
if (pathname === "/demo.demo.com") {
app.render(req, res, "/demo.demo.com", query);
}
...
And in _app.js
static async getInitialProps(appArgument) {
...
return {
...
renderFrom: "demo.demo.com"
};
}
Also in my host I have demo.demo.com point to localhost.
The site works for me in demo.demo.com:3000 but how to generalise it in production scenarios
with Database and CNAME Records and add/change CNAME Record automatically with User Action.
On Vercel (the creators of Next.js), we support Wildcard Domains out of the box. Within Next.js, you then only need to read the Domain from the headers of the incoming request, parse it and then respond with the right content.
I hope that was helpful!
I just found this blog post https://demo.vercel.pub/platforms-starter-kit, which was published 6 days ago.
It announces https://platformize.co/, a product that does just that.
Multi-tenant applications serve multiple customers across different subdomains/custom domains with a single unified codebase.
For example, this blog is a multi-tenant application:
Subdomain: demo.vercel.pub
Custom domain: platformize.co (maps to demo.vercel.pub)
Build your own: app.vercel.pub
Another example is Hashnode, a popular blogging platform. Each writer has their own unique .hashnode.dev subdomain for their blog:
eda.hashnode.dev
katycodesstuff.hashnode.dev
pit.hashnode.dev
Users can also map custom domains to their .hashnode.dev subdomain:
catalins.tech → pit.hashnode.dev

ALL possible issues of 404 NOT found laravel 6

I've been stuck in a weird problem for a couple of days. All my web application routes are working fine except one. Its has a 404 not found issue. So I checked:
My Routes list. It exists.
| | GET|HEAD | dashboard/profile/create | profile.create | App\Http\Controllers\Dashboard\ProfileController#create | web
URI in Routes list & Request URL in search box matches.
Request URL: http://localhost/CMSsk/CMS/public/dashboard/profile/create
Checked my blade Layout. No Problems.
<i class="fas fa-briefcase fa-2x mr-2"></i>Add Credentials
Cheked Controller. It exists.
public function create()
{
$user = Auth::user();
return view('Dashboard.Profile.profile-create',compact('user'));
}
Cheked Apache2 Rewrite module (Enabled) & Override ALL.
Used PHPUnit & Chrome Browser devtools to check networks,console,Apllication Cookies,storage. Can't find any issues other than 404.
Used PHPUnit testing and XDebug,dd() to trace problem. The Code doesn't reach Controller method.
Checked ALL possible Stack Overflow issues. Did not solve the problem.
Cleared browser Cache.
Did:
php artisan route:cache
Q: What are other possible issues that I might not have checked to solve this simple yet complicated issue?
Note: I referenced the form Page from another page which has a Social Media Sharing 3rd party Plugin Installed(AddThis). Hence I tried other form pages & other links from there and it works. So I'm confused why Only one page has issue(I thought the Plugin may have effect).
Update:
I fixed the Solution but I wanted to share how I did just so that anyone who stumbles upon this scenario finds some help.So here it goes:
Solution:
I created a Route group first which had the prefix named profile. It had 19 routes. Immediately after that I Created a Resource Route which had it's name prefix. So the two Identical names had a conflict for which I was not getting the page.
How I figured out:
I almost ran out of all possible solutions. So I started Manually testing the routes just to figure out if there's a pattern developing. I know it's not the most effective way but I wanted to figure out a pattern that's why I did it. After testing the Route group prefix named profile I figured out that all routes inside this group are NOT working from where I called it. Then I tested Routes outside that group from that specific blade view and it was working. So I changed the name of the Resource Route just to make it distinct from the Route group prefix. And it worked!

Using wildcards when mapping routes with MapWebPageRoute

In an ASP.NET Web Pages project (not Web Forms, not MVC) I am using Mike Brind's
More Flexible Routing For ASP.NET Web Pages.
I want to create a route that picks ups any number of route elements but ending in a specific word, eg:
mydomain.com/route1/word
mydomain.com/route1/route2/word
mydomain.com/route1/route2/route3/word
...etc etc
I tried to use wildcards when mapping the route but that didn't work, eg:
RouteTable.Routes.Ignore("{*routes}/word");
Is there a way to map these route possibilites or do I have to create a route for each possibiility, eg:
RouteTable.Routes.MapWebPageRoute("{route1}/word", "~/mypage.cshtml");
RouteTable.Routes.MapWebPageRoute("{route1}/{route2}/word", "~/mypage.cshtml");
RouteTable.Routes.MapWebPageRoute("{route1}/{route2}/{route3}/word", "~/mypage.cshtml");
...etc etc
I eventually figured out a solution to this.
RouteTable.Routes.MapWebPageRoute("{*routes}",
"~/mypage.cshtml",
constraints: new { routes = #".*(/word)" });
So using constraints was the answer.

2sxc: Failed to install application "Tutorial Razor Basics" (2sxcApp_Tutorial-RazorBasics_00.01.01.zip)

Maybe someone jumped already in this problem before while installing apps on this incredible usable App Module?
I failed to install application called "Tutorial Razor Basics" on 2sxc App Module. I got some errors defined below.
Other applications installed without problems.
Problem definition:
Error: The import failed. See the messages below for more information.
Warning: File 'Preview for Manage Content not Data.jpg' not copied because it already exists
Error: Could not import the app / package: An error occurred while updating the entries. See the inner exception for details.
Log from DNN Logs: System.NullReferenceException: Object reference not set to an instance of an object. at
ToSic.SexyContent.ImportExport.XmlImport.<>c.b__29_4(<>f__AnonymousType243 t)
in C:\projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\ImportExport\XmlImport.cs:line 456
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable1 source, Func2 predicate) at ToSic.SexyContent.ImportExport.XmlImport.ImportXmlTemplates(XElement root)
in C:\projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\ImportExport\XmlImport.cs:line 456
at ToSic.SexyContent.ImportExport.XmlImport.ImportXml(Int32 zoneId, Int32 appId, XDocument doc, Boolean leaveExistingValuesUntouched)
in C:\projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\ImportExport\XmlImport.cs:line 293
at ToSic.SexyContent.ImportExport.XmlImport.ImportApp(Int32 zoneId, XDocument doc, Nullable1& appId)
in C:\projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\ImportExport\XmlImport.cs:line 219
at ToSic.SexyContent.ImportExport.ZipImport.ImportZip(Stream zipStream, HttpServerUtility server, PortalSettings portalSettings, List`1 messages)
in C:\projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\ImportExport\ZipImport.cs:line 129
DNN Configuration:
I tried to install module on the following DNN configuration:
Win 7
DNN 8.0.3
2sxc module version 08.05.00 (RC version cloned from git-hub. Maybe this is why it failed to install?)
SQL 2014 Express
Enhancements:
Some enhancements could be made to "Applications Management UI". It is not a criticism but like a nice things to have:
1) Install a bunch of zips as it takes some time when you want to install several apps in one go. It could be made something like DNN has before when you could install a bunch of zips from particular Install/Modules folder.
2) List of apps could have additional fields "Version". And maybe a "Path" field identifying where the App is stored on the disk. To save some place, "Path" could be added on the app details view which opens when clicking on app item in app list on the grid).
3) Logging of install process. It would be easier to identify what app was failing and where. Especially when installing your own buggy apps ;)
We can use of cause DNN logging but it takes some time to filter out exact problem. Good SoC(Separation of Concerns) practice?
Thank you a lot for your time guys from "2sic internet solutions" creating this wonderful product.
Danke schön!
Best Regards,
Jonas
I checked last night code of this module trying to figure out where problem lies. It seems that import module XmlImport.cs (~\DesktopModules\ToSIC_SexyContent\SexyContent\ImportExport\XmlImport.cs) on SexyContent module fails when installing app "Tutorial Razor Basics" templates in private method ImportXmlTemplates().
It fails when parsing application manifest file App.config when importing templates for this application.
It builds a list of parsed templates objects where some of them are null. This is where problem basically lies. After amending some fixes seems that I can now import applications without problem. Application Import method gives now more logging information about success or failure when importing templates. I post those import results for future development for others if needed as it might help to identify which parameters are not correct in App.config file:
The import has been done. See the messages below for more information. (Toggle success messages)
File 'Preview for Manage Content not Data.jpg' not copied because it already exists
trouble with template 'Basic Content - Image Left' - either type, static or guid are null
trouble with template 'Basic Content - Image Left' - either type, static or guid are null
trouble with template 'Basic Content - Image Left' - either type, static or guid are null
Template 'Basic Content - Image Left' successfully imported.
trouble with template 'Basic Content - Sliding Preview' - either type, static or guid are null
Template 'Basic Content - Sliding Preview' successfully imported.
trouble with template 'Basic Content with Image Preview and slide-effect' - either type, static or guid are null
trouble with template 'Basic Content with Image Preview and slide-effect' - either type, static or guid are null
trouble with template 'Basic Content with Image Preview and slide-effect' - either type, static or guid are null
Template 'Basic Content with Image Preview and slide-effect' successfully imported.
trouble with template 'Basic Content with Lightbox Preview' - either type, static or guid are null
trouble with template 'Basic Content with Lightbox Preview' - either type, static or guid are null
trouble with template 'Basic Content with Lightbox Preview' - either type, static or guid are null
Template 'Basic Content with Lightbox Preview' successfully imported.
Template 'Learn Looping with #foreach' successfully imported.
Template 'Learn Replacing Text' successfully imported.
Template 'Learn to use variables' successfully imported.
Template 'Simple If Statement' successfully imported.

The matched route does not include a 'controller' route value on AJAX call (Sitecore)

I am having an issue with an AJAX call to a controller action, using POST and having 3 parameters sent and return JSON data. Whenever I try to call that on the developement server, it throws a 500 (Internal Server Error), with the description
The matched route does not include a 'controller' route value, which is required.
The main problem with this, is that on my local machine it actually works. The way the websites I am working on are structured, is without any App_Start files (so no custom route config).
Is there anyone who could help me with this? I am struggling with this for days now. Please keep in mind that I am trying this in Sitecore 7.1 (MVC) and IIS 7.5.
Thank you.
Best regards,
Marius.
The absence of App_Start files in your solution doesn't guarantee there aren't any custom routes. Check Global.asax in your local environment vs your development server as this is another area where custom routes may have been set up.