Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
2020-02-05 11:28:52 +01:00
parent 02234220e4
commit 32e09522bc
13 changed files with 3796 additions and 138 deletions

View File

@ -42,6 +42,7 @@ export default class PostPage extends Component<Props, States> {
/>
<meta key="og:title" property="og:title" content={`${this.props.post.header.title} - ${config.og.title}`} />
<title key="title">{`${this.props.post.header.title} - ${config.og.title}`}</title>
<meta
key="og:description"
property="og:description"
@ -50,12 +51,17 @@ export default class PostPage extends Component<Props, States> {
{this.props.post.header.image ? (
<meta key="og:image" property="og:image" content={`${config.domain}${this.props.post.header.image}`}/>
) : undefined}
<script type="application/javascript" async defer src="https://hashover.dzeio.com/comments.php"></script>
</Head>
{this.props.post === undefined ? (
<Error statusCode={404} />
) : (
<div>
<img src={this.props.post.header.image} alt={this.props.post.header.imageAlt} />
<picture>
<source srcSet={require(`../../images${this.props.post.header.image}?webp`)} type="image/webp" />
<source srcSet={require(`../../images${this.props.post.header.image}`)} type="image/png" />
<img src={require(`../../images${this.props.post.header.image}`)} alt={this.props.post.header.imageAlt} />
</picture>
<ReactMarkdown escapeHtml={false} source={emoji.emojify(this.props.post.content, null, (code, name) => `<span class="emoji">${code}</span>`)}/>
<h2>Détails</h2>
<p>Tags:</p>
@ -73,6 +79,7 @@ export default class PostPage extends Component<Props, States> {
) : undefined}
</div>
)}
<section id="hashover"></section>
<style jsx global>{`
main h1 {
font-size: 50px;
@ -99,6 +106,9 @@ export default class PostPage extends Component<Props, States> {
}
`}</style>
<style jsx>{`
#hashover {
padding: 40px 10% 0;
}
main div {
margin-top: -150px;
display: flex;

View File

@ -16,6 +16,7 @@ class MyApp extends App {
<meta key="description" name="description" content={config.og.description}/>
<meta key="og:url" property="og:url" content={config.domain + this.props.router.asPath} />
<title key="title">{config.og.title}</title>
<meta key="og:title" property="og:title" content={config.og.title}/>
<meta key="og:description" property="og:description" content={config.og.description}/>
<meta key="og:type" property="og:type" content="website" />

View File

@ -1,4 +1,5 @@
import Document, { Head, Html, Main, NextScript } from 'next/document'
import config from '../config'
class MyDocument extends Document {
public static async getInitialProps(ctx) {
@ -6,6 +7,12 @@ class MyDocument extends Document {
return { ...initialProps }
}
public componentDidMount() {
if (window.location.origin !== config.domain && window.location.hostname !== "localhost") {
window.location.replace(`${config.domain}${window.location.pathname}`)
}
}
public render() {
return (
<Html>