Skip to content

Commit

Permalink
docs: improve SEO with descriptions (#5360)
Browse files Browse the repository at this point in the history
  • Loading branch information
hamatoyogi authored Oct 26, 2023
1 parent ac7b6f3 commit ae23dbc
Show file tree
Hide file tree
Showing 23 changed files with 52 additions and 9 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
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Best Practices | Guides
description: Learn the best practices for Qwik, a guide for understanding how to use Qwik to its full potential.
contributors:
- mhevery
- the-r3aper7
Expand All @@ -12,6 +13,7 @@ contributors:
- un33k
- egmaleta
- mugan86
- hamatoyogi
---

# Best Practices
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
title: Bundle Optimization | Guides
description: Learn about bundle optimization in Qwik, a JavaScript framework for building web applications. This guide explains how to optimize your code by co-locating symbols and chunks, and provides examples of how to create and use symbols in your source code. Follow along with the code snippets and try them out in the included CodeSandbox demo.
contributors:
- mhevery
- hamatoyogi
---

import CodeSandbox from '../../../../../components/code-sandbox/index.tsx';
Expand Down Expand Up @@ -137,7 +139,7 @@ To collect symbol usage from a running application:
3. Open the console and type `symbols` to see the list of symbols used. Used that information to update the `vite.config.ts` file.


> **NOTE:** We are looking into creating better ways of collecting this information in the future.
> **NOTE:** We are looking into creating better ways of collecting this information in the future. (See [Insights](/docs/labs/insights/index.mdx).)
> **NOTE:** Symbols hashes are designed to be stable even across many compilations. However, if the code undergoes complex refactoring it is possible for the hash to change. This will not break the application, but it may cause the symbol to be moved to a different sub-optimal chunk until runtime analytics can be collected again.
Expand Down
2 changes: 2 additions & 0 deletions packages/docs/src/routes/docs/(qwikcity)/guides/mdx/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Markdown and MDX | Guides
description: Learn how to use Markdown and MDX in Qwik City.
contributors:
- manucorporat
- adamdbradley
Expand All @@ -9,6 +10,7 @@ contributors:
- cunzaizhuyi
- the-r3aper7
- zanettin
- hamatoyogi
---

# MDX
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: Qwik in a nutshell | Introduction
description: Learn the general concepts of Qwik in this shoet introduction guide.
contributors:
- manucorporat
- AnthonyPAlicea
- the-r3aper7
- hamatoyogi
---
# Qwik in a nutshell

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
title: Qwik for React developers
description: Learn the difference between React and Qwik in this handy cheat sheet.

contributors:
- the-r3aper7
- ChibiBlasphem
Expand All @@ -14,6 +16,7 @@ contributors:
- AnthonyPAlicea
- mhevery
- nsdonato
- hamatoyogi
---

# React Vs Qwik
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: Redirects | Guides
description: Learn how to use redirects in Qwik City.
contributors:
- adamdbradley
- manucorporat
- mhevery
- hamatoyogi
---

# Redirects
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
---
title: Serialization and Serialization Boundaries | Guides
description: Learn about serialization and serialization boundaries in Qwik, the process of converting data into a format that can be stored or transmitted.
contributors:
- fabien0102
- wuweiweiwu
- manucorporat
- adamdbradley
- voluntadpear
- hamatoyogi
---

# `$` Boundaries
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
title: Static Site Generation (SSG) Overview | Guides
description: Learn how static site generation (SSG) works in Qwik City.
contributors:
- adamdbradley
- AnthonyPAlicea
- mhevery
- hamatoyogi
---

# Static Site Generation (SSG) Overview
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
---
title: HTML attributes | QwikCity
description: Learn how to add attributes to the html tag, in order to add "lang" or other custom attributes.
contributors:
- bab2683
- hamatoyogi
---

# HTML attributes
Expand Down
1 change: 1 addition & 0 deletions packages/docs/src/routes/docs/(qwikcity)/routing/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Routing | Qwik City
description: Learn about routing in Qwik City which is like other file-system based such as Next.js, SvelteKit, SolidStart or Remix.
contributors:
- manucorporat
- nnelgxorz
Expand Down

0 comments on commit ae23dbc

Please sign in to comment.