-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add canonical tag to pages with pagination
- Loading branch information
1 parent
a85a48f
commit b620bea
Showing
9 changed files
with
231 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
||
<meta name="theme-color" content="#fff" /> | ||
<meta property="og:platform" content="PeerTube" /> | ||
<!-- Web Manifest file --> | ||
<link rel="manifest" href="/manifest.webmanifest?[manifestContentHash]"> | ||
|
||
<link rel="icon" type="image/png" href="/client/assets/images/favicon.png?[faviconContentHash]" /> | ||
<link rel="apple-touch-icon" href="/client/assets/images/icons/icon-144x144.png" sizes="144x144" /> | ||
<link rel="apple-touch-icon" href="/client/assets/images/icons/icon-192x192.png" sizes="192x192" /> | ||
|
||
<!-- logo background-image --> | ||
<style type="text/css"> | ||
.icon-logo { | ||
background-image: url(/client/assets/images/logo.svg?[logoContentHash]); | ||
} | ||
</style> | ||
|
||
<!-- base url --> | ||
<base href="/"> | ||
|
||
<!-- /!\ The following comment is used by the server to prerender some tags /!\ --> | ||
|
||
<!-- title tag --> | ||
<!-- description tag --> | ||
<!-- custom css tag --> | ||
<!-- meta tags --> | ||
<!-- server config --> | ||
|
||
<!-- /!\ Do not remove it /!\ --> | ||
</head> | ||
|
||
<!-- 3. Display the application --> | ||
<body id="custom-css"> | ||
|
||
<noscript class="alert alert-light"> | ||
<h1 class="alert-heading">PeerTube</h1> | ||
<h2 class="mb-3">JavaScript required</h2> | ||
|
||
<p>It seems JavaScript is either blocked or disabled in your web browser. We totally get that. However, this page will not work without it.</p> | ||
<p>If you are concerned about the security and privacy (or lack thereof) of JavaScript web applications, you might want to review the source code of the instance you are trying to access, or look for security audits.</p> | ||
|
||
<hr> | ||
|
||
<h2 class="mb-3">Your options</h2> | ||
|
||
<ul> | ||
<li>Allow JavaScript in your browser</li> | ||
<li>Use one of the <a class="link-orange" href="https://docs.joinpeertube.org/use/third-party-application" target="_blank">third-party applications</a> to browse this instance</li> | ||
<li>Review the source code on <a class="link-orange" href="https://github.com/Chocobozzz/PeerTube" target="_blank">GitHub</a> or <a class="link-orange" href="https://framagit.org/framasoft/peertube/PeerTube" target="_blank">Framasoft's GitLab</a>, and ask for modifications from the instance owner. | ||
</ul> | ||
</noscript> | ||
|
||
<div id="incompatible-browser" class="alert alert-light" role="alert" style="display: none"> | ||
<h1 class="alert-heading">PeerTube</h1> | ||
<h2 class="mb-3">Incompatible browser</h2> | ||
|
||
<p>We are sorry but it seems that PeerTube is not compatible with your web browser.</p> | ||
|
||
<hr> | ||
<p>Please try with the latest version of <a class="link-orange" href="https://www.mozilla.org" target="_blank">Mozilla Firefox</a>.</p> | ||
<p class="mb-0">If you think this is a mistake, please <a class="link-orange" href="https://github.com/Chocobozzz/PeerTube/issues/new" target="_blank">report it</a>.</p> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
function displayIncompatibleBrowser () { | ||
var elem = document.getElementById('incompatible-browser') | ||
if (elem.className.indexOf('browser-ok') === -1) { | ||
elem.style.display = 'block' | ||
} | ||
} | ||
|
||
window.onerror = function () { | ||
displayIncompatibleBrowser() | ||
} | ||
|
||
if (/MSIE|Trident/.test(window.navigator.userAgent) ) { | ||
displayIncompatibleBrowser() | ||
} | ||
</script> | ||
|
||
<my-app> | ||
</my-app> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { escapeHTML } from '@peertube/peertube-core-utils' | ||
import express from 'express' | ||
import { CONFIG } from '../../../initializers/config.js' | ||
import { WEBSERVER } from '../../../initializers/constants.js' | ||
import { PageHtml } from './page-html.js' | ||
import { TagsHtml } from './tags-html.js' | ||
|
||
export type VideosOrderType = 'local' | 'trending' | 'overview' | 'recently-added' | ||
|
||
export class VideosHtml { | ||
|
||
static async getVideosHTML (type: VideosOrderType, req: express.Request, res: express.Response) { | ||
const html = await PageHtml.getIndexHTML(req, res) | ||
|
||
return this.buildVideosHTML({ | ||
html, | ||
type, | ||
currentPage: req.query.page | ||
}) | ||
} | ||
|
||
// --------------------------------------------------------------------------- | ||
// Private | ||
// --------------------------------------------------------------------------- | ||
|
||
private static buildVideosHTML (options: { | ||
html: string | ||
type: VideosOrderType | ||
currentPage: string | ||
}) { | ||
const { html, currentPage, type } = options | ||
|
||
const title = type === 'recently-added' ? 'Recently added' : type.slice(0, 1).toUpperCase() + type.slice(1) | ||
let customHTML = TagsHtml.addTitleTag(html, title) | ||
customHTML = TagsHtml.addDescriptionTag(customHTML) | ||
|
||
let url = WEBSERVER.URL + '/videos/' + type | ||
|
||
if (currentPage) { | ||
url += `?page=${currentPage}` | ||
} | ||
|
||
return TagsHtml.addTags(customHTML, { | ||
url, | ||
|
||
escapedSiteName: escapeHTML(CONFIG.INSTANCE.NAME), | ||
escapedTitle: title, | ||
|
||
indexationPolicy: 'always' | ||
}, {}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters