1
0
mirror of https://github.com/ToxicCrack/PrintABrick.git synced 2025-05-28 01:30:11 -07:00

Add social media previews

issue #5
This commit is contained in:
Unknown 2017-06-05 15:18:49 +02:00
parent e78610b78e
commit 2e1d919ee8
8 changed files with 76 additions and 2 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -3,6 +3,17 @@
{% import 'macros/elements.html.twig' as elements %}
{% import 'macros/blocks.html.twig' as blocks %}
{% block meta %}
{{ blocks.meta(
name,
app.request.uri,
'meta.description' | trans | striptags('sup'),
app.request.schemeAndHttpHost~asset('resources/images/meta-logo.png'),
256,
256
)}}
{% endblock %}
{% block body %}
<div class="ui vertical inverted sidebar menu right">
<div class="ui search item category center aligned">

View File

@ -1,5 +1,18 @@
{% extends 'base.html.twig' %}
{% import 'macros/blocks.html.twig' as blocks %}
{% block meta %}
{{ blocks.meta(
name,
app.request.uri,
'meta.description' | trans | striptags('sup'),
app.request.schemeAndHttpHost~asset('resources/images/meta-logo.png'),
256,
256
)}}
{% endblock %}
{% block body %}
<div class="ui vertical inverted sidebar menu right">
<div class="ui search item category center aligned">

View File

@ -1,9 +1,12 @@
<!DOCTYPE html>
<html>
<html prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta name="description" content="{{ 'meta.description' | trans | striptags('sup') }}">
{% block meta %}
{% endblock %}
<title>{% block title %}{{ name }} - {{ 'meta.description' | trans | striptags('sup') }}{% endblock %}</title>
{% block stylesheets %}
<link rel="stylesheet" href="{{ fileTimestamp(asset('resources/css/style.css')) }}">
@ -18,7 +21,7 @@
</head>
<body class="default-theme body pushable">
{% block body %}
{% endblock %}
{% block javascripts %}
<script type="text/javascript" src="{{ fileTimestamp(asset('resources/js/three.js')) }}"></script>

View File

@ -103,4 +103,20 @@
{% macro ccal2_license(title,author) %}
"{{ title }}" by {{ author }}, used under <a href="https://creativecommons.org/licenses/by/2.0/">CC BY 2.0</a> / Converted to stl from original
{% endmacro %}
{% macro meta(title, url, description, image, imageHeight = 600, imageWidth = 900) %}
<meta property="og:title" content="{{ title }}">
<meta property="og:description" content="{{ description }}">
<meta property="og:url" content="{{ url }}">
<meta property="og:image" content="{{ image }}">
<meta property="og:image:width" content="{{ imageWidth }}">
<meta property="og:image:height" content="{{ imageHeight }}">
<meta property="twitter:card" content="summary">
<meta property="twitter:image:src" content="{{ image }}">
<meta property="twitter:site" content="{{ name }}">
<meta property="twitter:url" content="{{ url }}">
<meta property="twitter:description" content="{{ description }}">
<meta property="twitter:title" content="{{ title }}">
{% endmacro %}

View File

@ -2,8 +2,19 @@
{% import 'macros/blocks.html.twig' as blocks %}
{% block title %}{{ part.id }} - {{ part.name }}{% endblock %}
{% block header %}{{ part.name }}{% endblock %}
{% block meta %}
{{ blocks.meta(
part.id ~' '~ part.name,
app.request.uri,
'meta.description' | trans | striptags('sup'),
asset('-1/'~part.id~'.png') | imagine_filter('part_large')
)}}
{% endblock %}
{% block content %}
<div class="ui vertical segment secondary">
<div class="ui container stackable grid">

View File

@ -6,6 +6,15 @@
{% block header %}{{ set.name | escape('html') }}{% endblock %}
{% block meta %}
{{ blocks.meta(
set.id~' '~set.name ,
app.request.uri,
'meta.description' | trans | striptags('sup'),
asset(set.id~'.jpg')|imagine_filter('set_large')
)}}
{% endblock %}
{% block content %}
<div class="ui vertical segment secondary">

View File

@ -6,6 +6,17 @@
{% block header %}{{ 'page.set.index' | trans }}{% endblock %}
{% block meta %}
{{ blocks.meta(
name~' - '~'page.set.index' | trans ,
app.request.uri,
'meta.description' | trans | striptags('sup'),
app.request.schemeAndHttpHost~asset('resources/images/meta-logo.png'),
256,
256
)}}
{% endblock %}
{% block content %}
<div class="ui segment vertical">
<div class="ui container grid stackable divided">