Skip to content

Commit

Permalink
more SEO
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoav Ganbar committed Oct 26, 2023
1 parent 752c3b2 commit 5a1b927
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 8 deletions.
1 change: 1 addition & 0 deletions packages/docs/src/routes/docs/(qwikcity)/action/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: RouteAction$ | QwikCity
description: Learn about actions in QwikCity, allowing form submissions, and performing side effects such as writing to a database or sending an email.
contributors:
- manucorporat
- cunzaizhuyi
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
title: Complex Forms | Advanced
description: Learn how to create complex forms with arrays and objects.
contributors:
- ulic75
- hamatoyogi
---

# Complex Forms
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
---
title: Content Security Policy | Advanced
description: Learn how to create a content security policy (CSP) to keep your Qwik app safe.
contributors:
- tzdesign
- jordanw66
- hamatoyogi
---

# Content Security Policy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Menu | Advanced
description: How to use menus to define site navigation.
contributors:
- manucorporat
- adamdbradley
Expand All @@ -10,6 +11,7 @@ contributors:
- jakovljevic-mladen
- cunzaizhuyi
- AnthonyPAlicea
- hamatoyogi
---

# Menu
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
---
title: Request Handling | Advanced
description: How to handle requests in Qwik City, including REST endpoints, and middlewares.
contributors:
- adamdbradley
- manucorporat
- mhevery
- hamatoyogi
---

# Request handling

Each `layout.ts` and `index.ts` file inside the `src/routes` directory has the ability to access the current HTTP request, response, and URL. This allows you to retrieve and modify data, and even respond with custom content.

Qwik City implements a middleware system based on the hirarchy of the `src/routes` directory. The middleware system is used to handle HTTP requests and responses and is available to pages, layouts, and [endpoints](/docs/(qwikcity)/middleware/index.mdx).
Qwik City implements a middleware system based on the hirarchy of the `src/routes` directory. The middleware system is used to handle HTTP requests and responses and is available to pages, layouts, and [endpoints](/docs/(qwikcity)/endpoints/index.mdx).

Each route can add HTTP request and response handlers, allowing developers to retrieve and modify data. The handlers can also be used by [endpoints](/docs/(qwikcity)/middleware/index.mdx), which only respond with data rather than a page's HTML.
Each route can add HTTP request and response handlers, allowing developers to retrieve and modify data. The handlers can also be used by [endpoints](/docs/(qwikcity)/endpoints/index.mdx), which only respond with data rather than a page's HTML.

This feature enables you to handle any request event, have side effects on the request pipeline, just before you render the component and respond with custom content. It is available to pages, layouts and endpoint routes, but not on regular components.

## Request and Response Handlers

On pages, layouts, and [endpoints](/docs/(qwikcity)/middleware/index.mdx), we can access request data by implementing request handler functions such as `onGet`, `onPost`, `onPut`, etc. These functions are executed according to the [HTTP method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) used for this route.
On pages, layouts, and [endpoints](/docs/(qwikcity)/endpoints/index.mdx), we can access request data by implementing request handler functions such as `onGet`, `onPost`, `onPut`, etc. These functions are executed according to the [HTTP method](https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods) used for this route.

Additionally, an `onRequest` function can be used to handle any request method, rather than a specific one. For example, if both `onGet` and `onRequest` is provided, for a `GET` request, the `onGet` will be called. However, in this scenario, if a `POST` request method came in, then the `onRequest` handler would be called since an `onPost` was not provided.
Additionally, an `onRequest` function can be used to handle any request method, rather than a specific one, in the form of a [middleware](/docs/(qwikcity)/middleware/index.mdx). For example, if both `onGet` and `onRequest` is provided, for a `GET` request, the `onGet` will be called. However, in this scenario, if a `POST` request method came in, then the `onRequest` handler would be called since an `onPost` was not provided.
The `onRequest` is available as a catch-all to any request methods that do not have a specific method.

```tsx
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
---
title: Advanced Routing | Qwik City
description: Learn about advanced routing in Qwik City, including 404 page handling, grouped layouts, named layouts, nested layouts, and plugin.ts files.
contributors:
- manucorporat
- adamdbradley
- cunzaizhuyi
- the-r3aper7
- mhevery
- jakovljevic-mladen
- hamatoyogi
---

# Advanced Routing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
title: Generating Sitemaps | Advanced
description: Learn how to generate a sitemap for your site in Qwik City.
contributors:
- adamdbradley
- hamatoyogi
---

# Generating Sitemaps
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Speculative Module Fetching | Advanced
description: Learn how Qwik handles loading bundles in the background and filling the cache with Speculative Module Fetching.
contributors:
- ulic75
- mhevery
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
title: Static Assets | Advanced
description: How to serve static assets in your Qwik app.
contributors:
- manucorporat
- Oyemade
- mhevery
- adamdbradley
- the-r3aper7
- hamatoyogi
---

# Static Assets
Expand Down
4 changes: 3 additions & 1 deletion packages/docs/src/routes/docs/(qwikcity)/api/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: API reference | QwikCity
title: API reference | Qwik City
description: Qwik City API reference.
contributors:
- manucorporat
- adamdbradley
Expand All @@ -14,6 +15,7 @@ contributors:
- Mhmdrza
- ulic75
- mhevery
- hamatoyogi
---

# API reference
Expand Down
4 changes: 3 additions & 1 deletion packages/docs/src/routes/docs/(qwikcity)/caching/index.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: Caching | QwikCity
title: Caching | Qwik City
description: Learn how to handle caching in your Qwik City app to keep your site as fast as possible.
contributors:
- steve8708
- harishkrishnan24
- maiieul
- hamatoyogi
---

# Caching Responses
Expand Down
3 changes: 2 additions & 1 deletion packages/docs/src/routes/docs/(qwikcity)/endpoints/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Endpoints | QwikCity
title: Endpoints | Qwik City
description: Endpoints are middleware functions used to control and return data in various formats like RESTful API, GraphQL API, JSON, XML, reverse proxy, or other API types.
contributors:
- adamdbradley
- manucorporat
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Environment variables | QwikCity
title: Environment variables | Qwik City
description: Qwik apps can read environment variables in two main ways build-time variables and server-side variables.
contributors:
- manucorporat
- the-r3aper7
Expand Down

0 comments on commit 5a1b927

Please sign in to comment.