Use SiteUrl for OG tag paths

This commit is contained in:
Kieran 2023-05-22 15:44:59 +01:00
parent e0652dfbb8
commit 002b105f65
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
4 changed files with 8386 additions and 79 deletions

View File

@ -1,5 +1,6 @@
@using VoidCat.Model
@model VoidCat.Controllers.IndexController.IndexModel
@inject VoidSettings settings
<!DOCTYPE html>
<html lang="en">
<head>
@ -20,9 +21,14 @@
<meta property="og:url" content="@($"https://{Context.Request.Host}/{Model.Id.ToBase58()}")"/>
var mime = Model.Meta.MimeType;
if (mime != default)
if (!string.IsNullOrEmpty(mime))
{
var link = $"https://{Context.Request.Host}/d/{Model.Id.ToBase58()}";
var ub = new UriBuilder(settings.SiteUrl)
{
Path = $"/d/{Model.Id.ToBase58()}"
};
var link = ub.ToString();
if (mime.StartsWith("image/"))
{
<meta property="og:image" content="@link"/>

View File

@ -4,6 +4,7 @@
"src/*"
],
"scripts": {
"build": "yarn workspace @void-cat/api build && yarn workspace @void-cat/app build"
"build": "yarn workspace @void-cat/api build && yarn workspace @void-cat/app build",
"start": "yarn workspace @void-cat/api build && yarn workspace @void-cat/app start"
}
}

View File

@ -0,0 +1,58 @@
{
"name": "@void-cat/app",
"version": "0.1.0",
"private": true,
"proxy": "http://localhost:7195",
"dependencies": {
"@hcaptcha/react-hcaptcha": "^1.1.1",
"@reduxjs/toolkit": "^1.7.2",
"@types/node": "^18.16.3",
"@types/qrcode.react": "^1.0.2",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.1",
"@types/sjcl": "^1.0.30",
"moment": "^2.29.4",
"qrcode.react": "^1.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-helmet": "^6.1.0",
"react-redux": "^7.2.6",
"react-router-dom": "^6.2.1",
"react-scripts": "5.0.0",
"recharts": "^2.1.10",
"sjcl": "^1.0.8",
"typescript": "^5.0.4"
},
"devDependencies": {
"@craco/craco": "^6.4.5",
"@types/preval.macro": "^3.0.0",
"@types/react-helmet": "^6.1.6",
"cra-bundle-analyzer": "^0.1.1",
"http-proxy-middleware": "^2.0.6",
"preval.macro": "^5.0.0"
},
"scripts": {
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}

File diff suppressed because it is too large Load Diff