Skip to content

Commit

Permalink
fix: SEO fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
joshua-mo-143 committed Dec 24, 2024
1 parent bf40539 commit 14b1a72
Show file tree
Hide file tree
Showing 28 changed files with 51 additions and 25 deletions.
2 changes: 1 addition & 1 deletion community/contribute.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Contributing
description: "This document describes the best way to get started with contributing to Shuttle"
description: "Learn about the best way to get started with contributing to Shuttle."
icon: "code-pull-request"
---

Expand Down
3 changes: 2 additions & 1 deletion community/get-involved.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Get Involved"
description: "Learn how to get involved with Shuttle."
icon: "hand-holding-hand"
---

Expand All @@ -25,7 +26,7 @@ If you are wondering what the best way is to get involved, here's how:
<Card
title="Follow us on Twitter"
icon="twitter"
href="https://twitter.com/shuttle_dev"
href="https://x.com/shuttle_dev"
color="#1DA1F2"
>
Go to @shuttle_dev on Twitter
Expand Down
1 change: 1 addition & 0 deletions community/open-source.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Open Source"
description: "Learn about how to get involved with the open source side of Shuttle."
icon: "osi"
---

Expand Down
1 change: 1 addition & 0 deletions examples/examples-repo-link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
title: "All Examples"
url: "https://github.com/shuttle-hq/shuttle-examples#readme"
icon: "github"
noindex: true
---
6 changes: 5 additions & 1 deletion examples/other.mdx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
This section contains examples for the following frameworks: Tower, Warp, Salvo, Poem, Thruster, and Tide.
---
title: "Other Examples"
description: "This section contains examples for the following frameworks: Tower, Warp, Salvo, Poem, Thruster, and Tide."
icon: "github"
---

### Hello World

Expand Down
1 change: 1 addition & 0 deletions examples/serenity-todo.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Todo List Bot"
description: "Learn how to write a Serenity bot that can manage a to-do list."
---

### Prerequisites
Expand Down
1 change: 1 addition & 0 deletions integrations/custom-resources.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Custom Resources"
description: "This example shows how you can make a custom Shuttle resource annotation."
icon: "toolbox"
---

Expand Down
1 change: 1 addition & 0 deletions integrations/shuttle-openai.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "OpenAI"
description: "Learn about Shuttle's OpenAI resource annotation."
icon: "microchip"
---

Expand Down
1 change: 1 addition & 0 deletions integrations/shuttle-opendal.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Apache OpenDAL"
description: "Learn about Shuttle's OpenDAL resource annotation."
icon: "database"
---
This plugin allows services to connect to [Apache OpenDAL™](https://github.com/apache/opendal). OpenDAL is a data access layer that allows users to easily and efficiently retrieve data from various storage services in a unified way.
Expand Down
1 change: 1 addition & 0 deletions integrations/shuttle-turso.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Turso"
description: "Learn about how to use Shuttle with Turso, a distributed SQLite cloud service."
icon: "database"
---

Expand Down
2 changes: 1 addition & 1 deletion introduction/docs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ icon: "hand-wave"
title="Follow us on Twitter"
icon="twitter"
color="#1DA1F2"
href="https://twitter.com/shuttle_dev"
href="https://x.com/shuttle_dev"
>
Go to @shuttle_dev on Twitter
</Card>
Expand Down
1 change: 1 addition & 0 deletions introduction/how-shuttle-works.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "How Shuttle works"
description: "Learn about how Shuttle works."
icon: "puzzle-piece"
---

Expand Down
1 change: 0 additions & 1 deletion migrations/frameworks/actix-web.mdx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
---
title: "Actix Web"
description: "How to migrate a web service that uses Actix Web to Shuttle"

---

## Reference
Expand Down
8 changes: 4 additions & 4 deletions platform-update/platform-update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ Introducing the new Shuttle platform! We've supercharged what developers love ab

### Access the NEW platform

- New Console: [console.shuttle.dev](http://console.shuttle.dev)
- New Docs: [docs.shuttle.dev](http://docs.shuttle.dev)
- New Console: [console.shuttle.dev](https://console.shuttle.dev)
- New Docs: [docs.shuttle.dev](https://docs.shuttle.dev)
- Command Line: new `shuttle` command (installed alongside `cargo shuttle`)

### Access the OLD platform (for existing users)

- Old Console: [console.shuttle.rs](http://console.shuttle.rs)
- Old Docs: [docs.shuttle.rs](http://docs.shuttle.rs)
- Old Console: [console.shuttle.rs](https://console.shuttle.rs)
- Old Docs: [docs.shuttle.rs](https://docs.shuttle.rs)
- Command Line: `cargo shuttle` (unchanged)

## Changelog
Expand Down
1 change: 1 addition & 0 deletions resources/resources.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Resources"
description: "Learn about the resources that are officially supported by Shuttle."
icon: "boxes-stacked"
---

Expand Down
1 change: 1 addition & 0 deletions resources/shuttle-shared-db.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Shuttle Shared Databases"
description: "Learn about the Shuttle Shared Database resource."
icon: "database"
---

Expand Down
1 change: 1 addition & 0 deletions support/faq.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Frequently Asked Questions"
description: "Learn about the most frequently asked questions from Shuttle users."
icon: "comment-question"
---

Expand Down
1 change: 1 addition & 0 deletions support/troubleshooting.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Troubleshooting"
description: "Learn about how to solve common problems you might run into while using Shuttle."
icon: "bug"
---

Expand Down
1 change: 1 addition & 0 deletions templates/fullstack/saas-template.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "SaaS Starter Template"
description: Learn how you can deploy a fully working SaaS template using Next.js & Rust.
---

We've created a SaaS template that you can use to get started quickly with a fullstack Rust + Next.js app.
Expand Down
1 change: 1 addition & 0 deletions templates/overview.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Overview"
description: "Learn more about the official Shuttle templates."
'og:title': "Shuttle Templates - Overview"
---

Expand Down
1 change: 1 addition & 0 deletions templates/tutorials/authentication.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Authentication"
description: "Learn how to implement authentication using Rust."
---

Most websites have some kind of user system. But implementing authentication can
Expand Down
13 changes: 7 additions & 6 deletions templates/tutorials/databases-with-rust.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
title: "Working with Databases in Rust"
description: "Learn how to work with databases using Rust."
---

In this guide we'll be looking at working with PostgresQL & `shuttle-persist` (Shuttle's key-value data store) and how we can interface with them easily using Rust. By the end of this guide you'll have more of an idea of how to use both and when each one would be better for your use case.

It will be assumed you already have a project initialised - if not, you can always initialise a new project with `shuttle init`.

## SQL
## SQL
Relational databases are the classical way to store data in the backend of web applications when it comes to storing records and persisted data. Shuttle currently offers free provisioned SQL instances for your applications and currently provides it through an SQLx connection pool. It should be noted that although we're using Postgres for this guide, the same concepts works equally well with both MySQL and MariaDB.

To get started with SQLx (and using our new database), we'll want to add the `sqlx` crate to an initialised Rust program. We will also want to add the `shuttle-shared-db` crate which allows us to use the macro that provisions the database instance to us.
Expand Down Expand Up @@ -75,7 +76,7 @@ let query = sqlx::query::_as<_, Message>("SELECT id, message FROM messages")
.await;
```

This is much more convenient for us for gathering information since we already know what we want the outputted data type from the query to be, so when we carry out the query it'll now automatically be converted into a vector of structs.
This is much more convenient for us for gathering information since we already know what we want the outputted data type from the query to be, so when we carry out the query it'll now automatically be converted into a vector of structs.

One of SQLx's main strengths in addition to the above is being able to create data for compile-time queries. To do this, we'll want to enable the macros flag for SQLx by adding the `macros` feature flag to SQLx in our Cargo.toml file, though if following this guide from the start you'll probably have it already. If not, you can run this command:

Expand Down Expand Up @@ -124,12 +125,12 @@ cargo add serde --features derive
Then you need to add the Serialize derive macro to your structs as required, and then when you return the JSON-serialized data it'll automatically be accepted as a HTTP-compatible response.

## shuttle-persist
Shuttle Persist is shuttle's own persistent key-value style store that you can use to store your data in and is great for storing long-term data that you might need on the server but you don't need a relational database for, or you want to be able to store data that's still structured via structs but you also might want to store metadata (ie total number of records, combined value of something from all structs in a vector, or similar).
Shuttle Persist is shuttle's own persistent key-value style store that you can use to store your data in and is great for storing long-term data that you might need on the server but you don't need a relational database for, or you want to be able to store data that's still structured via structs but you also might want to store metadata (ie total number of records, combined value of something from all structs in a vector, or similar).
To get started, we'll want to add `shuttle-persist` to an already initialised Rust program by adding the crate:

```bash
cargo add shuttle-persist
cargo add shuttle-persist
```

`shuttle-persist` works by taking a struct or other type and using that as the basis of what we want to save our value as for the key-value store, using the Deserialize & Serialize derive macros from Serde to be able to convert it to/from JSON to make it HTTP response-compatible. We'll want to create a struct that will act as the field type and attach the macros mentioned previously:
Expand Down Expand Up @@ -184,10 +185,10 @@ async fn add_record(
Json(req): Json<Person>,
) -> Result<impl IntoResponse, impl IntoResponse> {
let mut data = state.persist.load::<Data>("data");
data.people.push( Person { name: req.name, age: req.age } );
data.total_records += 1;
match state.persist.save::<Data>("data", data) {
Ok(_) => Ok((StatusCode::OK, "Successful!".to_string())),
Err(e) => Err((StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))
Expand Down
7 changes: 4 additions & 3 deletions templates/tutorials/discord-weather-forecast.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Discord Weather Forecast Bot"
description: "Learn how to write a Discord bot that can get the weather forecast."
---

In this tutorial, we will look at a simple way to add custom functionality to a
Expand All @@ -14,7 +15,7 @@ The full code can be found in
### Registering our bot

Before we start making our bot, we need to register it for Discord. We do that
by going to https://discord.com/developers/applications and creating a new
by going to [the Discord Developers applications page](https://discord.com/developers/applications) and creating a new
application.

![](/images/discord-weather-forecast-1.png)
Expand Down Expand Up @@ -60,9 +61,9 @@ Oh, they're offline 😢
At this moment, our bot is not running because there is no code. We will have to
write it and run it before we can start interacting with it.

### [Serenity](https://docs.rs/serenity/latest/serenity/index.html)
### Serenity

Serenity is a library for writing Discord bots (and communicating with the
[Serenity](https://docs.rs/serenity/latest/serenity/index.html) is a library for writing Discord bots (and communicating with the
Discord API).

If you don't have Shuttle yet, you can install it with
Expand Down
13 changes: 7 additions & 6 deletions templates/tutorials/rest-http-service-with-axum.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Writing a Rest HTTP Service with Axum"
description: "Learn how to write a REST HTTP service with Axum."
---

In this guide you'll learn the basics of how to write a competent Axum HTTP REST service - first starting off with basic routing and writing functions to act as our endpoints, adding app State and middleware functions, using cookies and CORS, then finally looking at testing our app.
Expand Down Expand Up @@ -86,7 +87,7 @@ Now if we plug this into a router that has this function using a GET request at
Hello world 32!
```

Now that we know the basics of writing endpoint functions, we can use them to write a router that has a few endpoints and can take multiple request methods at an endpoint that uses dynamic routing.
Now that we know the basics of writing endpoint functions, we can use them to write a router that has a few endpoints and can take multiple request methods at an endpoint that uses dynamic routing.

```rust
async fn router() -> Router {
Expand Down Expand Up @@ -158,9 +159,9 @@ impl FromRef<AppState> for ApiState {

### Static Files

Let's say you want to serve some static files using Axum - or that you have an application made using a frontend JavaScript framework like React, and you want to combine it with your Axum backend to make one large application instead of having to host your frontend and backend separately. How would you do that?
Let's say you want to serve some static files using Axum - or that you have an application made using a frontend JavaScript framework like React, and you want to combine it with your Axum backend to make one large application instead of having to host your frontend and backend separately. How would you do that?

Axum does not by itself have capabilities to be able to do this; however, what it does have is super-strong compatibility with `tower-http`, which offers utility for serving your own static files whether you're running a SPA, statically-generated files from a framework like Next.js or simply just raw HTML, CSS and JavaScript.
Axum does not by itself have capabilities to be able to do this; however, what it does have is super-strong compatibility with `tower-http`, which offers utility for serving your own static files whether you're running a SPA, statically-generated files from a framework like Next.js or simply just raw HTML, CSS and JavaScript.

If you're using static-generated files, you can easily slip this into your router (assuming your static files are in a 'dist' folder at the root of your project):

Expand Down Expand Up @@ -213,7 +214,7 @@ struct AppState {
key: Key,
}

// this impl tells `SignedCookieJar` and `PrivateCookieJar how to access the
// this impl tells `SignedCookieJar` and `PrivateCookieJar how to access the
// key from our state
impl FromRef<AppState> for Key {
fn from_ref(state: &AppState) -> Self {
Expand All @@ -224,7 +225,7 @@ impl FromRef<AppState> for Key {
#[shuttle_runtime::main]
async fn axum() -> shuttle_axum::ShuttleAxum {
let state = AppState {
key: Key::generate()
key: Key::generate()
};

// ... the rest of your code
Expand Down Expand Up @@ -276,7 +277,7 @@ async fn logout(

### Middleware

Middleware is essentially a function that runs before the client hits an endpoint; it can be used for things like adding a wait time to prevent server overload, to validating user sessions from cookies. Fortunately, middleware in Axum is quite simple to use!
Middleware is essentially a function that runs before the client hits an endpoint; it can be used for things like adding a wait time to prevent server overload, to validating user sessions from cookies. Fortunately, middleware in Axum is quite simple to use!

There's two ways to be able to create middleware in Axum, but we will be focusing on the more simple way which is to just write a function that uses Axum's middleware utilities as parameters, then simply just adding it to our router and declaring it as middleware. We can also add middleware that uses state this way too, which is great as it means we can share a database connection pool (for example) in the middleware:

Expand Down
1 change: 1 addition & 0 deletions templates/tutorials/send-your-logs-to-datadog.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: 'Using Shuttle with Datadog'
description: "Learn how to send your logs to Datadog with Roberto."
---

> written by [Roberto Huertas](https://robertohuertas.com/)
Expand Down
3 changes: 2 additions & 1 deletion templates/tutorials/serverless-calendar-app.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Serverless Calendar App"
description: "Learn how to build a serverless calendar application with Matthias."
---

> written by [Matthias Endler](https://endler.dev/)
Expand Down Expand Up @@ -362,7 +363,7 @@ shuttle deploy
Right, that's all. It's that easy. Thanks to the folks over at
[shuttle.dev](https://github.com/shuttle-hq/shuttle) for making this possible.

The calendar app is now available at https://zerocal.shuttle.app.
The calendar app is now available at `https://zerocal.shuttle.app`.

Now I can finally send my friends a link to a calendar event for our next pub
crawl. They'll surely appreciate it.yeahyeah
Expand Down
1 change: 1 addition & 0 deletions templates/tutorials/url-shortener.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "URL Shortener"
description: "Learn how to write a URL shortener with Terrence."
---

I was trying to get to sleep on a Wednesday night - I check my phone, it's 2:54
Expand Down
1 change: 1 addition & 0 deletions templates/tutorials/websocket-chat-app-js.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: "Chat app with React & Rust"
description: "Learn how to write a Rust chat application with React on the frontend."
---

Source code can be found [here](https://github.com/joshua-mo-143/react-websocket-chat-rust).
Expand Down

0 comments on commit 14b1a72

Please sign in to comment.