Skip to content

Commit 8239220

Browse files
committed
Use full url for document and packet viewing
1 parent c8b08ba commit 8239220

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

templates/Document/View.phtml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ $description = Common::stripUpTo(trim(filter_var(
1212
($object ? $object->getContent(true) : "The requested document does not exist or could not be found."),
1313
FILTER_SANITIZE_STRING
1414
)), "\n", 300);
15-
$this->opengraph->attach(new Pair("url", "/document/" . urlencode($object_id)));
1615
$this->opengraph->attach(new Pair("type", "article"));
1716

1817
$url = Common::relativeUrlToAbsolute("/document/" . urlencode($object_id));
19-
if ($object)
18+
if ($object) {
2019
$url .= "/" . Common::sanitizeForUrl($object->getTitle(), true);
20+
$this->opengraph->attach(new Pair("url", "/document/" . urlencode($object_id)
21+
. "/" . Common::sanitizeForUrl($object->getTitle(), true)));
22+
} else {
23+
$this->opengraph->attach(new Pair("url", "/document/" . urlencode($object_id)));
24+
}
2125

2226
#$this->additional_css[] = "/a/document.css";
2327
require("./header.inc.phtml");

templates/Packet/View.phtml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@ $description = Common::stripUpTo(trim(filter_var(
1212
($object ? $object->getPacketRemarks(true) : "The requested packet does not exist or could not be found."),
1313
FILTER_SANITIZE_STRING
1414
)), "\n", 300);
15-
$this->opengraph->attach(new Pair("url", "/packet/" . urlencode($object_id)));
1615
$this->opengraph->attach(new Pair("type", "article"));
1716

1817
$url = Common::relativeUrlToAbsolute("/packet/" . urlencode($object_id));
1918
if ($object) {
2019
$url .= "/" . Common::sanitizeForUrl($object->getPacketName(), true);
20+
$this->opengraph->attach(new Pair("url", "/packet/" . urlencode($object_id)
21+
. "/" . Common::sanitizeForUrl($object->getPacketName(), true)));
2122

2223
$packet_id = $object->getPacketId(true);
2324
$title = $packet_id . " " . $title;
25+
} else {
26+
$this->opengraph->attach(new Pair("url", "/packet/" . urlencode($object_id)));
2427
}
2528

2629
$this->additional_css[] = "/a/packet.css";

0 commit comments

Comments
 (0)