Skip to content

Commit d6d7ea1

Browse files
committed
update
1 parent 881b363 commit d6d7ea1

File tree

6 files changed

+56
-80
lines changed

6 files changed

+56
-80
lines changed
Lines changed: 20 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
gtag("js", new Date());
8989
gtag("config", "G-1B67VYZMXF");
9090
</script>
91-
<script type="module" crossorigin src="/assets/index-BKG20kvp.js"></script>
91+
<script type="module" crossorigin src="/assets/index-BtezKpUb.js"></script>
9292
<link rel="stylesheet" crossorigin href="/assets/index-rakNYPth.css">
9393
</head>
9494

vix-site/src/data/examples.js

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ export const EXAMPLES = {
99
title: "HTTP: /api/ping",
1010
desc: "A minimal JSON ping route.",
1111
code: `#include <vix.hpp>
12-
1312
using namespace vix;
1413
1514
int main()
1615
{
1716
App app;
1817
19-
app.get("/api/ping", [](Request &, Response &res)
20-
{
18+
app.get("/api/ping", [](Request &, Response &res){
2119
res.json({
2220
"ok", true,
2321
"message", "pong"
@@ -42,18 +40,15 @@ HTTP/1.1 200 OK
4240
desc: "Read query values with defaults.",
4341
code: `#include <vix.hpp>
4442
#include <string>
45-
4643
using namespace vix;
4744
4845
int main()
4946
{
5047
App app;
5148
52-
app.get("/search", [](Request &req, Response &res)
53-
{
49+
app.get("/search", [](Request &req, Response &res){
5450
const std::string q = req.query_value("q", "");
5551
const std::string page = req.query_value("page", "1");
56-
5752
res.json({
5853
"ok", true,
5954
"q", q,
@@ -80,25 +75,21 @@ HTTP/1.1 200 OK
8075
desc: "Reject requests unless a required header is present.",
8176
code: `#include <vix.hpp>
8277
#include <vix/middleware/app/adapter.hpp>
83-
8478
using namespace vix;
8579
8680
int main()
8781
{
8882
App app;
8983
90-
// ------------------------------------------------------------
9184
// Middleware inline: require header x-demo: 1
92-
// ------------------------------------------------------------
9385
auto require_demo_header =
94-
middleware::HttpMiddleware([](Request &req,
95-
Response &res,
96-
middleware::Next next)
97-
{
86+
middleware::HttpMiddleware(
87+
[](Request &req,
88+
Response &res,
89+
middleware::Next next){
9890
const std::string value = req.header("x-demo");
9991
100-
if (value.empty() || value != "1")
101-
{
92+
if (value.empty() || value != "1"){
10293
res.status(401).json({
10394
"error", "unauthorized",
10495
"hint", "Missing or invalid header",
@@ -108,19 +99,19 @@ int main()
10899
return; // block request
109100
}
110101
111-
next(); });
102+
next();
103+
});
112104
113105
// Attach middleware ONLY to /api/ping
114106
middleware::app::install_exact(
115107
app,
116108
"/api/ping",
117109
middleware::app::adapt(require_demo_header));
118110
119-
// ------------------------------------------------------------
120111
// Route
121-
// ------------------------------------------------------------
122-
app.get("/api/ping", [](Request &, Response &res)
123-
{ res.json({"ok", true, "message", "pong"}); });
112+
app.get("/api/ping", [](Request &, Response &res){
113+
res.json({"ok", true, "message", "pong"});
114+
});
124115
125116
app.run(8080);
126117
return 0;
@@ -162,14 +153,12 @@ vix run server.cpp --log-format=json-pretty --log-level=debug --log-color=always
162153
desc: "Serve HTTP routes and typed WebSocket events from a single runtime.",
163154
code: `#include <vix.hpp>
164155
#include <vix/websocket/AttachedRuntime.hpp>
165-
166156
using namespace vix;
167157
168158
int main()
169159
{
170160
// Default config path "config/config.json" and port 8080
171-
vix::serve_http_and_ws([](auto &app, auto &ws)
172-
{
161+
vix::serve_http_and_ws([](auto &app, auto &ws){
173162
// Minimal HTTP route
174163
app.get("/api/ping", [](auto&, auto& res) {
175164
res.json({
@@ -182,8 +171,7 @@ int main()
182171
ws.on_typed_message(
183172
[&ws](auto& session,
184173
const std::string& type,
185-
const vix::json::kvs& payload)
186-
{
174+
const vix::json::kvs& payload){
187175
(void)session;
188176
189177
if (type == "chat.message") {

vix-site/src/data/home.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ i Hint: Ctrl+C to stop`,
5151
title: "It really is this simple",
5252
subtitle: "A tiny HTTP route you can run immediately.",
5353
code: `#include <vix.hpp>
54-
5554
using namespace vix;
5655
5756
int main() {

vix-site/src/router/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ const routes = [
2323
component: Home,
2424
meta: {
2525
seo: {
26-
title: "Vix.cpp Modern C++ backend runtime",
26+
title: "Vix.cpp A Modern C++ Backend Runtime",
2727
description:
28-
"Vix.cpp is a modern C++ backend runtime focused on performance, clean DX, HTTP/WebSocket, middleware, and a practical registry workflow.",
28+
"Vix.cpp is a modern C++ runtime built as a serious alternative to Node.js, Deno, and Bun. It is designed for unreliable networks, offline-first workflows, peer-to-peer systems, and extreme native performance.",
2929
path: "/",
3030
type: "website",
3131
jsonLd: {
@@ -35,7 +35,7 @@ const routes = [
3535
applicationCategory: "DeveloperApplication",
3636
operatingSystem: "Linux, macOS, Windows",
3737
description:
38-
"Vix.cpp is a modern C++ backend runtime focused on performance, clean DX, HTTP/WebSocket, middleware, and a practical registry workflow.",
38+
"Vix.cpp is a modern C++ runtime built as a serious alternative to Node.js, Deno, and Bun. It is designed for unreliable networks, offline-first workflows, peer-to-peer systems, and extreme native performance.",
3939
url: "https://vixcpp.com/",
4040
},
4141
},
@@ -65,7 +65,7 @@ const routes = [
6565
title: "Examples",
6666
description:
6767
"Copy/paste ready Vix.cpp examples: HTTP, middleware, JSON logs, WebSocket, registry workflow.",
68-
path: "/examples",
68+
path: "/docs/examples",
6969
},
7070
},
7171
},
@@ -206,7 +206,12 @@ router.afterEach((to) => {
206206
const seo = to.meta?.seo;
207207

208208
if (!seo) {
209-
setSEO({ title: "Vix.cpp", description: "Modern C++ backend runtime." });
209+
setSEO({
210+
title: "Vix.cpp A Modern C++ Backend Runtime",
211+
description:
212+
"Vix.cpp is a modern C++ runtime built as a serious alternative to Node.js, Deno, and Bun.",
213+
path: "/",
214+
});
210215
return;
211216
}
212217

vix-site/src/utils/seo.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
const DEFAULTS = {
22
siteName: "Vix.cpp",
3-
title: "Vix.cpp Modern C++ backend runtime",
3+
title: "Vix.cpp A Modern C++ Backend Runtime",
44
description:
5-
"Vix.cpp is a modern C++ backend runtime focused on performance, clean DX, HTTP/WebSocket, middleware, and a practical registry workflow.",
6-
// keep it as a stable root; later you can switch to https://vixcpp.com
5+
"Vix.cpp is a modern C++ runtime built as a serious alternative to Node.js, Deno, and Bun. It is designed for unreliable networks, offline-first workflows, peer-to-peer systems, and extreme native performance.",
76
baseUrl: "https://vixcpp.com",
87
twitter: "@vix_cpp",
9-
image: "/og.png", // put an actual og image later
8+
image:
9+
"https://res.cloudinary.com/dwjbed2xb/image/upload/v1769499528/vix_banniere_zljwdt.png",
1010
};
1111

1212
function ensureMeta(nameOrProp, value, isProperty) {
@@ -59,7 +59,7 @@ function ensureJsonLd(id, obj) {
5959
* Set SEO tags for the current route.
6060
*
6161
* @param {Object} opts
62-
* @param {string} [opts.title] - Page title (without site suffix).
62+
* @param {string} [opts.title] - Page title (can be full title).
6363
* @param {string} [opts.description] - Meta description.
6464
* @param {string} [opts.path] - Route path for canonical (e.g. "/install").
6565
* @param {string} [opts.canonical] - Full canonical URL override.
@@ -69,11 +69,12 @@ function ensureJsonLd(id, obj) {
6969
*/
7070
export function setSEO(opts = {}) {
7171
const siteName = DEFAULTS.siteName;
72+
const rawTitle = (opts.title || DEFAULTS.title).trim();
7273

73-
const pageTitle = (opts.title || DEFAULTS.title).trim();
74-
const fullTitle = pageTitle.includes(siteName)
75-
? pageTitle
76-
: `${pageTitle}${siteName}`;
74+
let fullTitle = rawTitle;
75+
if (!rawTitle.includes(siteName) && rawTitle !== DEFAULTS.title) {
76+
fullTitle = `${rawTitle} | ${siteName}`;
77+
}
7778

7879
const description = (opts.description || DEFAULTS.description).trim();
7980

@@ -116,14 +117,10 @@ export function setSEO(opts = {}) {
116117
}
117118
}
118119

119-
/**
120-
* Convenience presets for your pages.
121-
* You can call these inside each page component.
122-
*/
123120
export const SEO_PRESETS = {
124121
home() {
125122
setSEO({
126-
title: "Vix.cpp Modern C++ backend runtime",
123+
title: "Vix.cpp A Modern C++ Backend Runtime",
127124
description: DEFAULTS.description,
128125
path: "/",
129126
type: "website",

0 commit comments

Comments
 (0)