Sveltekit very simple routing example for beginners - url-routing

Simple file based routing
I want a website to allow the following
http://127.0.0.1:5173/ show index page
http://127.0.0.1:5173/social
http://127.0.0.1:5173/walks
http://127.0.0.1:5173/members/social
http://127.0.0.1:5173/members/walks
In other words show the index page + 4 different web pages
It has changed in Aug 2022 so at the moment there lots of examples on the web that are now out of date.

Solution
within Sveltekit project folder
src\routes\
src\routes\+page.svelte -this is the index page
src\routes\social\+page.svelte
src\routes\walks\+page.svelte
src\routes\members\social\+page.svelte
src\routes\members\walks\+page.svelte
each +page.svelte should have the contents specific to that page
In summary each web page is in its own folder and called +page.svelte.
I created social, walks, members\social and members\walks folders and added +page.svelte to each
More details here
https://www.netlify.com/blog/migrating-breaking-changes-in-sveltekit/

Related

Hugo - multiple sections of website with their own local taxonomies?

I'm building a website that has "blog" section and and "guide" section, like this:
mywebsite.com/blog/
mywebsite.com/guide/
Both blog and guide contain their own multiple posts. I'd like to add independent tags (taxonomies) to both blog and guide, so that I could list posts by specific tags, for example:
mywebsite.com/blog/tags/some_blog_tag
mywebsite.com/guide/tags/some_guide_tag
What should be my project's folder and file structure - both content folder and layouts folder - to implement this? It seems that hugo is built around the idea that the taxonomy should be global for the entire website. However, there are also "page bundles" in hugo. Can hugo define local taxonomies inside page bundles? I find the docs very confusing on this topic.
Also, what should be added to the config.json file to create such section local taxonomies?
I tried the following folder structure, but I get "page not found" when I access mywebsite.com/blog/tags/some_blog_tag or mywebsite.com/guide/tags/some_guide_tag
- content
- blog
_index.md
blog_content1.md
blog_content2.md
blog_content3.md
- guide
_index.md
guide_content1.md
guide_content2.md
guide_content3.md
- layouts
- blog
list.html
taxonomy.html
- guide
list.html
taxonomy.html
One way to achieve that would be to use a multilingual site, with three languages:
one language named en (default)
one language named blog
the last one named guide
and adding the parameter defaultContentLanguageInSubdir: false
By doing so, you can host all your non blog/guide pages in the en language, and each blog/guide pages will have their own taxonomy as required.
See documentation for more information
https://gohugo.io/content-management/multilingual/

Drupal 9 - Two different URL's work for same page

I have a Drupal 9.x version site, as an example whose page URL is like : http://www.example.com/general
but we need that URL to be work as http://www.example.com/something/general also.
It means, my every page of my site to be work (both URL's) with or without PRE-FIX word before of every page name.
Reason: I am looking this feature is, my website page has to load into other website pages. Which means with an iframe I am planning to display the drupal 9.x content into other website. With this PREFIX word if we are calling the URL the header, footer, sidebar of the present page site will be hidden.
If with out the PREFIX word if i am looking the website, the header, footer, sidebar will be displayed normally.
Both URLs should work:
I have about 550+ content pages, and many of our content pages are coming from custom modules, views.
I tried with URL alias, If i have go with this then I have to add these all 550+ content pages URL in our URL alias, that will not work for me.
Is there any other way around that i can achieve the same with minimum effort.
Please suggest me the solution, It will be very helpful for me.

SvelteKit adapter-static: Support incremental build enabling generating only a specific page instead of entire site

We have some medium website (> pages) and would like to prerender the entire site. Upon content changes in some external system, we would like to update only the specific page which contains the updated content and deploy the updated version of the page as static html page to some publishing service (webserver, CDN, Netlify, etc.).
I have seen that SvelteKit supports this SSG rendering approach through the adapter-static but as far as I've seen it always builds all the pages/routes for every build. This is currently a blocker because if an editor updates some content it takes more than 15 minutes (rough estimate if you have around 1500 pages) to see this update online.
Is there already some possibility to simply build some specific page or route?
Looks like that this is still an open feature request and to be discussed there: https://github.com/sveltejs/kit/issues/2369

When to use Static site generator?

I have a web application that has login and role-based contents etc. which is created in nuxt (framework for vue)using universal mode .currently it is SSR(server-side rendering) app but Is it correct if convert it into static site using nuxt generate command ?
FYI:- I have tried running nuxt generate , it generates appropriate pages inside dist but my concern is inside each HTML files, only CSS is there and script tag. I understand i cannot statically generate contents for each page since it's based on users.knowing that is it correct if I go with SSG or does it kills its purpose?
Avoid SSG for sites with content that changes often(dynamic) for logged in user.
Update:-
Lot of great sites out there for helping developers new to this, such as
https://jamstack.org/
https://explorers.netlify.com/
At the end, its way of generating html for each routes with contents at build time(some new methods also being worked on by netlify and vercel for improving build time for big jamstack sites) and once user visits home page, its html served and js kicks in and does SPA part for further navigation instead of full page refresh + interactivity

Why is my angularjs site not completely crawlable?

I have created my first AngularJS website. I have set up pushstate (html5 mode), added fragment metatag, created sitemap in google and tested "google fetch" functionality. After few days, my website is still not completely indexed by google. Google indexed only 1 url instead of 4 (my sitemap contains 4 url's). My website is Tom IT. This main page is index, but this subpage that is also in the sitemap (you can find my sitemap in sitemap.xml in the root of my domain tom-it.be), does not appear in search results. I also added robots.txt.
Google crawlers can parse the pages that generated by SPA and appear at SERPs, but not immediately, may need several days. In my experience, use AngularJS may need 3 days, and use EmberJS need 7 days.
If your website wants to be crawled completely, the important information should put in HTML, or use other techniques, for example, prepare another page for crawlers, server pre-rendering or PhantomJS.

Resources