mirror of
https://git.cant.at/Madeorsk/PollVerlaine
synced 2024-11-10 20:54:33 +01:00
WIP: OpenGraph implementation
This commit is contained in:
parent
1caad26fb9
commit
ec29bfe947
13
index.php
13
index.php
@ -36,6 +36,7 @@ Flight::route("GET /polls/@id:[a-fA-F0-9]+", function ($id) {
|
||||
else
|
||||
{
|
||||
Flight::render("poll", ["app_url" => $VERLAINE["app_url"], "poll" => $poll], "body_content");
|
||||
Flight::render("opengraph", ["poll" => $poll, "app_url" => $VERLAINE["app_url"]], "head");
|
||||
Flight::render("layout");
|
||||
}
|
||||
}
|
||||
@ -104,6 +105,7 @@ Flight::route("GET /polls/@id:[a-fA-F0-9]+/results", function ($id) {
|
||||
{
|
||||
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]], "results_chart");
|
||||
Flight::render("results", ["poll" => $poll, "chart_colors" => $VERLAINE["chart_colors"]], "body_content");
|
||||
Flight::render("opengraph", ["poll" => $poll, "app_url" => $VERLAINE["app_url"]], "head");
|
||||
Flight::render("layout");
|
||||
}
|
||||
}
|
||||
@ -135,6 +137,17 @@ Flight::route("GET|DELETE /polls/@id:[a-fA-F0-9]+/@token:[a-fA-F0-9]+", function
|
||||
Flight::notFound();
|
||||
});
|
||||
|
||||
Flight::route("GET /polls/@id:[a-fA-F0-9]+/results/svg", function ($id) {
|
||||
global $VERLAINE;
|
||||
$poll = Poll::load_poll($id);
|
||||
if ($poll)
|
||||
{
|
||||
Flight::render("svg/results", ["poll" => $poll, "colors" => $VERLAINE["chart_colors"]]);
|
||||
}
|
||||
else
|
||||
Flight::notFound();
|
||||
});
|
||||
|
||||
Flight::route("/", function () {
|
||||
global $VERLAINE;
|
||||
Flight::render("home", ["app_url" => $VERLAINE["app_url"]], "body_content");
|
||||
|
@ -6,6 +6,9 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Poll Verlaine</title>
|
||||
<link rel="stylesheet" type="text/css" href="<?= $VERLAINE["app_url"] ?>/static/css/main.css" />
|
||||
<?php if(isset($head)): ?>
|
||||
<?= $head ?>
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
<body>
|
||||
<?= $body_content ?>
|
||||
|
6
views/opengraph.php
Normal file
6
views/opengraph.php
Normal file
@ -0,0 +1,6 @@
|
||||
<meta property="og:site_name" content="PollVerlaine" />
|
||||
<meta property="og:title" content="<?= $poll->title ?>" />
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:url" content="<?= $app_url ?>/polls/<?= $poll->id ?>" />
|
||||
<meta property="og:image" content="<?= $app_url ?>/polls/<?= $poll->id ?>/results/svg" />
|
||||
<meta property="og:image:type" content="image/svg+xml"/>
|
Loading…
Reference in New Issue
Block a user