Commit 1aa4404d authored by  JosephK's avatar JosephK
Browse files

Merge branch 'master' into 'master'

Metadata

See merge request framasoft/accueil!64
parents d725d114 3d68acad
<template> <template>
<div id="app"> <div id="app">
<vue-headful <vue-headful
:title="$t('meta.title')" :title="meta.title"
:description="$t('meta.description')" :description="meta.description"
:html="{ body: {id: $route.meta.id } }" :html="{ body: {id: $route.meta.id } }"
:lang="$route.meta.lang" :lang="$route.meta.lang"
:keywords="$t('meta.keywords')"
:head="{ :head="{
'link[rel^=shortcut]': {href: `${$root.baseurl}/icons/favicon.png`}, 'link[rel^=shortcut]': {href: meta.favicon},
'link[rel=apple-touch-icon]': {href: `${$root.baseurl}/icons/apple-touch-icon.png`}, 'link[rel=apple-touch-icon]': {href: meta.appleicon},
'link[rel=canonical]': {href: `${$root.canonical}${$route.path}`}, 'link[rel=canonical]': {href: meta.url},
'meta[property^=og][property$=title]': {content: `${$t('meta.title')}`}, 'meta[property^=og][property$=title]': {content: meta.title},
'meta[property^=og][property$=image]': {content: `${$t('baseurl')}/icons/apple-touch-icon.png`}, 'meta[property^=og][property$=image]': {content: meta.img},
'meta[property^=og][property$=url]': {content: $t('baseurl')}, 'meta[property^=og][property$=url]': {content: meta.url},
'meta[property^=og][property$=description]': {content: `${$t('meta.description')}`}, 'meta[property^=og][property$=description]': {content: meta.description},
'meta[name^=twitter][name$=title]': {content: `${$t('meta.title')}`}, 'meta[name^=twitter][name$=title]': {content: meta.title},
'meta[name^=twitter][name$=image]': {content: `${$t('baseurl')}/icons/apple-touch-icon.png`}, 'meta[name^=twitter][name$=image]': {content: meta.img},
'meta[name^=twitter][name$=description]': {content: `${$t('meta.description')}`}, 'meta[name^=twitter][name$=description]': {content: meta.description},
'meta[name=author]': {content: $t('meta.name') }, 'meta[name=author]': {content: meta.author},
'meta[name^=DC][name$=title]': {content: $t('meta.title') },
'meta[name^=DC][name$=publisher]': {content: $t('meta.name') },
'meta[name^=DC][name$=contributor]': {content: $t('meta.name') },
'meta[name^=DC][name$=language]': {content: $t('lang') },
'meta[name^=DC][name$=subject]': {content: $t('meta.keywords') },
'meta[name^=DC][name$=rights]': {content: $t('meta.license') },
'meta[name^=DC][name$=description]': {content: $t('meta.desc') },
}" }"
/> />
<router-view></router-view> <router-view></router-view>
...@@ -38,9 +30,25 @@ ...@@ -38,9 +30,25 @@
<script> <script>
export default { export default {
data() { data() {
return process.env.NODE_ENV === 'development' const title = this.$te(`meta.${this.$route.meta.id}.title`)
? { i18n: this.$i18n.messages } ? this.text(this.$t(`meta.${this.$route.meta.id}.title`))
: {} : this.text(this.$t(`meta.title`));
const description = this.$te(`meta.${this.$route.meta.id}.description`)
? this.text(this.$t(`meta.${this.$route.meta.id}.description`))
: this.text(this.$t(`meta.description`));
return {
meta: {
title,
description,
author: this.$te('meta.author') ? this.$t('meta.author') : '',
img: `${this.$t('baseurl').replace(/\/$/, '')}/img/opengraph/${this.$route.meta.id}.jpg`,
url: `${this.$t('meta.canonical').replace(/\/$/, '')}${this.$route.path}`,
favicon: `${this.$t('baseurl').replace(/\/$/, '')}/icons/favicon.png`,
appleicon: `${this.$t('baseurl').replace(/\/$/, '')}/icons/apple-touch-icon.png`,
},
i18n: process.env.NODE_ENV === 'development' ? this.$i18n.messages : ''
}
} }
} }
</script> </script>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// @import 'frameworks/bootstrap4'; // @import 'frameworks/bootstrap4';
/* Fonts */ /* Fonts */
@import '../../../node_modules/fork-awesome/css/fork-awesome.css'; @import '../../../node_modules/fork-awesome/css/fork-awesome.min.css';
@import 'fonts/ptsans_caption'; @import 'fonts/ptsans_caption';
/* Variables */ /* Variables */
......
<template> <template>
<div class="container ombre apropos"> <div class="container ombre apropos">
<vue-headful
:title="`${$t('txt.soft')} - ${$t('asso.title')}`"
/>
<header class="clearfix header"> <header class="clearfix header">
<h1 class="pull-left" v-html="$t('asso.title')"></h1> <h1 class="pull-left" v-html="$t('asso.title')"></h1>
<I18n/> <I18n/>
......
<template> <template>
<div class="container ombre apropos"> <div class="container ombre apropos">
<vue-headful
:title="`${$t('txt.soft')} - ${$t('cgu.title')}`"
/>
<header class="clearfix header"> <header class="clearfix header">
<h1 class="pull-left" v-html="$t('cgu.title')"></h1> <h1 class="pull-left" v-html="$t('cgu.title')"></h1>
<I18n/> <I18n/>
......
<template> <template>
<div class="container ombre apropos"> <div class="container ombre apropos">
<vue-headful
:title="`${$t('txt.soft')} - ${$t('charte.title')}`"
/>
<header class="clearfix header"> <header class="clearfix header">
<h1 class="pull-left" v-html="$t('charte.title')"></h1> <h1 class="pull-left" v-html="$t('charte.title')"></h1>
<I18n/> <I18n/>
......
<template> <template>
<div class="container ombre apropos"> <div class="container ombre apropos">
<vue-headful
:title="`${$t('txt.soft')} - ${$t('credits.title')}`"
/>
<header class="clearfix header"> <header class="clearfix header">
<h1 class="pull-left" v-html="$t('credits.title')"></h1> <h1 class="pull-left" v-html="$t('credits.title')"></h1>
<I18n/> <I18n/>
......
<template> <template>
<div class="container ombre apropos"> <div class="container ombre apropos">
<vue-headful
:title="`${$t('txt.soft')} - ${$t('graphics.title')}`"
/>
<header class="clearfix header"> <header class="clearfix header">
<h1 class="pull-left" v-html="$t('graphics.title')"></h1> <h1 class="pull-left" v-html="$t('graphics.title')"></h1>
<I18n/> <I18n/>
......
<template> <template>
<main> <main>
<vue-headful
:title="$t('meta.title')"
/>
<intro /> <intro />
<more /> <more />
......
<template> <template>
<div class="container ombre apropos"> <div class="container ombre apropos">
<vue-headful
:title="`${$t('txt.soft')} - ${$t('legals.title')}`"
/>
<header class="clearfix header"> <header class="clearfix header">
<h1 class="pull-left" v-html="$t('legals.title')"></h1> <h1 class="pull-left" v-html="$t('legals.title')"></h1>
<I18n/> <I18n/>
......
<template> <template>
<div class="container ombre apropos"> <div class="container ombre apropos">
<vue-headful
:title="`${$t('txt.soft')} - ${$t('moderation.title')}`"
/>
<header class="clearfix header"> <header class="clearfix header">
<h1 class="pull-left" v-html="$t('moderation.title')"></h1> <h1 class="pull-left" v-html="$t('moderation.title')"></h1>
<I18n/> <I18n/>
......
...@@ -12,6 +12,9 @@ meta: ...@@ -12,6 +12,9 @@ meta:
canonical: https://framasoft.org canonical: https://framasoft.org
description: Description is neededed for search engines, Twitter card and OpenGraph description: Description is neededed for search engines, Twitter card and OpenGraph
# i18n: http://trad.framasoft.org/iteration/view/<project_name>/master # i18n: http://trad.framasoft.org/iteration/view/<project_name>/master
about:
title: '@:meta.title - @:about'
description: '@:meta.lead'
txt: txt:
# soft: text from color.soft (but you can reassign it here) # soft: text from color.soft (but you can reassign it here)
......
...@@ -2,8 +2,23 @@ meta: ...@@ -2,8 +2,23 @@ meta:
title: Framasoft title: Framasoft
author: Framasoft author: Framasoft
canonical: https://framasoft.org canonical: https://framasoft.org
description: '@:home.intro.text'
i18n: https://trad.framasoft.org/iteration/view/framasoft/master i18n: https://trad.framasoft.org/iteration/view/framasoft/master
employees: '9' employees: '9'
association:
title: '@:txt.soft - @:asso.title'
cgu:
title: '@:txt.soft - @:cgu.title'
charte:
title: '@:txt.soft - @:charte.title'
credits:
title: '@:txt.soft - @:credits.title'
graphics:
title: '@:txt.soft - @:graphics.title'
legals:
title: '@:txt.soft - @:legals.title'
moderation:
title: '@:txt.soft - @:moderation.title'
# Catégories # Catégories
cat: cat:
......
...@@ -3,16 +3,6 @@ full: Classic home ...@@ -3,16 +3,6 @@ full: Classic home
meta: meta:
title: '@:txt.soft ~ Change the world one byte at a time' title: '@:txt.soft ~ Change the world one byte at a time'
lead: There is a long way to go, but the road is Free… lead: There is a long way to go, but the road is Free…
description: 'A French non-profit (Association française de loi 1901), originating
as an education project, @:txt.soft is a network aimed at popular education,
focussing mostly on free and open source software. The network is organized following
3 main themes on a collaborative model: promotion, diffusion and development of
libre software, enhancement of free (as in free speech) culture. We also provide
free online services. The portal Homepage introduces the whole range of actions
by @:txt.soft and provides links to the various sites and projects of the
network.'
keywords: '@:txt.soft, libre software, free and open source sofware, free culture,
FOSS, FLOSS, promotion and diffusion of free software, open source'
license: '@:license.ccbysa4 except when notified' license: '@:license.ccbysa4 except when notified'
nav: nav:
lite: Quick access lite: Quick access
......
...@@ -3,15 +3,6 @@ full: Accès classique ...@@ -3,15 +3,6 @@ full: Accès classique
meta: meta:
title: '@:txt.soft - Changer le monde, un octet à la fois.' title: '@:txt.soft - Changer le monde, un octet à la fois.'
lead: La route est longue mais la voie est libre… lead: La route est longue mais la voie est libre…
description: 'Association française de loi 1901, issue du monde éducatif, @:txt.soft
est un réseau d’éducation populaire consacré principalement au logiciel libre.
Le réseau s’organise en trois axes sur un mode collaboratif: promotion, diffusion
et développement de logiciels libres, enrichissement de la culture libre. Il offre
également des services libres en ligne. La page portail du réseau présente l’ensemble
des activités de @:txt.soft et propose des liens vers les différents sites
et activités du réseau.'
keywords: '@:txt.soft, logiciels libres, logiciels libres et open source, culture
libre, FOSS, promotion et diffusion des logiciels libres, open source'
license: '@:license.ccbysa4 sauf mention contraire' license: '@:license.ccbysa4 sauf mention contraire'
nav: nav:
lite: Accès rapide lite: Accès rapide
......
...@@ -3,16 +3,6 @@ full: Home classica ...@@ -3,16 +3,6 @@ full: Home classica
meta: meta:
title: '@:txt.soft ~ Cambiare il mondo un byte alla volta' title: '@:txt.soft ~ Cambiare il mondo un byte alla volta'
lead: La strada è lunga, ma la via è libera… lead: La strada è lunga, ma la via è libera…
description: 'Associazione no-profit francese (Association française de loi 1901),
nata come progetto educativo: @:txt.soft è una rete rivolta all’educazione
popolare, incentrata principalmente sul software libero e open source. La rete
è organizzata su un modello collaborativo incentrato su 3 tematiche principali:
promozione, diffusione e sviluppo del software libero, rafforzamento della cultura
libera. Forniamo anche servizi gratuiti online. La home page del portale introduce
all’intera gamma di azioni @:txt.soft e fornisce collegamenti ai vari siti
e progetti della rete.'
keywords: '@:txt.soft, software libero, gratuito e open source, cultura libera,
FOSS, FLOSS, promozione e diffusione di software libero, open source'
license: '@:license.ccbysa4 ad eccezione di casi diversamente notificati' license: '@:license.ccbysa4 ad eccezione di casi diversamente notificati'
nav: nav:
lite: Quick access lite: Quick access
......
import marked from 'marked';
export default { export default {
install(Vue) { install(Vue) {
Object.defineProperty(Vue.prototype, 'text', { Object.defineProperty(Vue.prototype, 'text', {
value: (html, options) => { // eslint-disable-line value: (html, options) => { // eslint-disable-line
let text = ''; let text = '';
const tmp = new DOMParser().parseFromString(html, 'text/html'); const tmp = new DOMParser().parseFromString(marked(html.replace(/  \n/g, ' \n')), 'text/html'); // eslint-disable-line no-irregular-whitespace
text = tmp.body.textContent || ''; text = tmp.body.textContent || '';
if (options) { if (options) {
if (/latin/.test(options)) { if (/latin/.test(options)) {
......
...@@ -5,27 +5,13 @@ ...@@ -5,27 +5,13 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title> <title></title>
<meta name="description"/> <meta name="description"/>
<meta name="url" content="https://framasoft.org" />
<meta name="author" content="">
<meta name="keywords" content="" />
<!--metas DC-->
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/" />
<meta name="DC.type" content="Text" />
<meta name="DC.format" content="text/html" />
<meta name="DC.identifier" scheme="URI" content="https://framasoft.org" />
<meta name="DC.title" content="" />
<meta name="DC.publisher" content="" />
<meta name="DC.contributor" content="" />
<meta name="DC.language" scheme="RFC3066" content="" />
<meta name="DC.subject" content="" />
<meta name="DC.rights" content="" />
<meta name="DC.description" content="" />
<!-- fin metas DC -->
<link rel="shortcut icon" href="" /> <link rel="shortcut icon" href="" />
<link rel="apple-touch-icon" href="" /> <link rel="apple-touch-icon" href="" />
<link rel="canonical" href="" />
<meta name="author" content="">
<meta property="og:type" content="article"> <meta property="og:type" content="article">
<meta property="og:title" content=""> <meta property="og:title" content="">
<meta property="og:image" content=""> <meta property="og:image" content="">
......
This diff is collapsed.
...@@ -14,7 +14,13 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); ...@@ -14,7 +14,13 @@ const OptimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin');
const VueLoaderPlugin = require('vue-loader/lib/plugin'); const VueLoaderPlugin = require('vue-loader/lib/plugin');
const PreloadWebpackPlugin = require('preload-webpack-plugin'); const PreloadWebpackPlugin = require('preload-webpack-plugin');
let root = (process.env.NODE_ENV === 'preview') ? `/${process.env.INIT_CWD.match(/([^/]*)\/*$/)[1]}/` : '/'; const mode = {
dev: process.env.NODE_ENV === 'development',
preview: process.env.NODE_ENV === 'preview',
prod: process.env.NODE_ENV === 'prod',
};
let root = mode.preview ? `/${process.env.INIT_CWD.match(/([^/]*)\/*$/)[1]}/` : '/';
for (let i = 0; i < process.argv.length; i += 1) { for (let i = 0; i < process.argv.length; i += 1) {
if (process.argv[i].indexOf('--root=') > -1) { if (process.argv[i].indexOf('--root=') > -1) {
root = `/${process.argv[i].split('=')[1]}/`; root = `/${process.argv[i].split('=')[1]}/`;
...@@ -33,7 +39,7 @@ const config = { ...@@ -33,7 +39,7 @@ const config = {
output: { output: {
path: path.resolve(__dirname, `public${root}`), path: path.resolve(__dirname, `public${root}`),
publicPath: root, publicPath: root,
filename: process.env.NODE_ENV !== 'development' ? '[name].[hash].bundle.js' : '[name].bundle.js', filename: !mode.dev ? '[name].[hash].bundle.js' : '[name].bundle.js',
// chunkFilename: '[name].bundle.js', // chunkFilename: '[name].bundle.js',
}, },
module: { module: {
...@@ -101,8 +107,8 @@ const config = { ...@@ -101,8 +107,8 @@ const config = {
plugins: [ plugins: [
new VueLoaderPlugin(), new VueLoaderPlugin(),
new MiniCssExtractPlugin({ new MiniCssExtractPlugin({
filename: process.env.NODE_ENV !== 'production' ? '[name].css' : '[name].[hash].css', filename: !mode.prod ? '[name].css' : '[name].[hash].css',
chunkFilename: process.env.NODE_ENV !== 'production' ? '[id].css' : '[id].[hash].css', chunkFilename: !mode.prod ? '[id].css' : '[id].[hash].css',
}), }),
new webpack.HotModuleReplacementPlugin(), new webpack.HotModuleReplacementPlugin(),
new CopyWebpackPlugin(assets), new CopyWebpackPlugin(assets),
...@@ -144,10 +150,24 @@ fs.readdirSync('./app/locales') ...@@ -144,10 +150,24 @@ fs.readdirSync('./app/locales')
} }
}); });
const routes = [];
const pages = [];
// Import pages list
fs.readdirSync('./app/components/pages')
.forEach(file => pages.push(file.replace(/(.*)\.vue/, '$1')));
for (let j = 0; j < pages.length; j += 1) {
routes.push(`${root}${pages[j].toLowerCase().replace('home', '')}`);
// Localized routes
for (let i = 0; i < locales.length; i += 1) {
routes.push(`${root}${locales[i]}${pages[j].toLowerCase().replace(/^/, '/').replace('/home', '')}`);
}
}
// Get last app modified time // Get last app modified time
const date = JSON.stringify(fs.statSync('./app').mtime); const date = JSON.stringify(fs.statSync('./app').mtime);
if (process.env.NODE_ENV === 'development') { if (mode.dev) {
module.exports.plugins = (module.exports.plugins || []) module.exports.plugins = (module.exports.plugins || [])
.concat([ .concat([
new webpack.DefinePlugin({ new webpack.DefinePlugin({
...@@ -164,20 +184,6 @@ if (process.env.NODE_ENV === 'development') { ...@@ -164,20 +184,6 @@ if (process.env.NODE_ENV === 'development') {
}), }),
]); ]);
} else { // NODE_ENV === 'production|preview' } else { // NODE_ENV === 'production|preview'
const routes = [];
const pages = [];
// Import pages list
fs.readdirSync('./app/components/pages')
.forEach(file => pages.push(file.replace(/(.*)\.vue/, '$1')));
for (let j = 0; j < pages.length; j += 1) {
routes.push(`${root}${pages[j].toLowerCase().replace('home', '')}`);
// Localized routes
for (let i = 0; i < locales.length; i += 1) {
routes.push(`${root}${locales[i]}${pages[j].toLowerCase().replace(/^/, '/').replace('/home', '')}`);
}
}
module.exports.devtool = '#source-map'; module.exports.devtool = '#source-map';
module.exports.optimization = { module.exports.optimization = {
minimizer: [ minimizer: [
...@@ -195,7 +201,7 @@ if (process.env.NODE_ENV === 'development') { ...@@ -195,7 +201,7 @@ if (process.env.NODE_ENV === 'development') {
module.exports.plugins.push( module.exports.plugins.push(
new webpack.DefinePlugin({ new webpack.DefinePlugin({
'process.env': { 'process.env': {
NODE_ENV: ((process.env.NODE_ENV !== 'production') ? '"preview"' : '"production"'), NODE_ENV: `"${process.env.NODE_ENV}"`,
BASE_URL: `"${root.split('/')[1]}"`, BASE_URL: `"${root.split('/')[1]}"`,
DATE: date, DATE: date,
}, },
...@@ -230,23 +236,43 @@ if (process.env.NODE_ENV === 'development') { ...@@ -230,23 +236,43 @@ if (process.env.NODE_ENV === 'development') {
} }
// Create ./public/img/lg/* symlinks only if images need translation // Create ./public/img/lg/* symlinks only if images need translation
if (fs.existsSync('./app/assets/img/fr')) { const img = {
if (!fs.existsSync('./public')) { fs.mkdirSync('./public'); } assets: './app/assets/img/',
if (!fs.existsSync(`./public${root}`)) { fs.mkdirSync(`./public${root}`); } relative: mode.dev ? '../../../app/assets/img/' : '../', // [dev] relative to assets ; [prod] relative to public
if (!fs.existsSync(`./public${root}img`)) { fs.mkdirSync(`./public${root}img`); } public: `./public${root}img/`,
};
if (fs.existsSync(`${img.assets}fr`)) {
if (!fs.existsSync(img.public)) {
fs.mkdirSync(img.public, { recursive: true });
}
for (let i = 0; i < locales.length; i += 1) { for (let i = 0; i < locales.length; i += 1) {
if (!fs.existsSync(`./public${root}img/${locales[i]}`)) { if (!fs.existsSync(`${img.public}${locales[i]}`)) {
fs.mkdirSync(`./public${root}img/${locales[i]}`); fs.mkdirSync(`${img.public}${locales[i]}`);
} }
fs.readdirSync('./app/assets/img/fr').forEach((file) => {
if (!fs.existsSync(`./app/assets/img/${locales[i]}/${file}`)) { fs.readdirSync(`${img.assets}fr`).forEach((file) => {
const symlinkOrigin = (process.env.NODE_ENV === 'development') if (!fs.existsSync(`${img.assets}${locales[i]}/${file}`)) {
? `../../../app/assets/img/fr/${file}` // [dev] relative to assets fs.symlink(`${img.relative}fr/${file}`,
: `../fr/${file}`; // [prod] relative to public `${img.public}${locales[i]}/${file}`,
fs.symlink(symlinkOrigin,
`./public${root}img/${locales[i]}/${file}`,
(err) => { console.log(err) }); // eslint-disable-line (err) => { console.log(err) }); // eslint-disable-line
} }
}); });
} }
} }
// Create ./public/img/opengraph/*.jpg symlinks for each page
if (fs.existsSync(`${img.assets}opengraph/home.jpg`)) {
if (!fs.existsSync(`${img.public}opengraph`)) {
fs.mkdirSync(`${img.public}opengraph`, { recursive: true });
}
for (let i = 0; i < pages.length; i += 1) {
if (!fs.existsSync(`${img.assets}opengraph/${pages[i].toLowerCase()}.jpg`)) {
fs.symlink(`${img.relative}opengraph/home.jpg`,
`${img.public}opengraph/${pages[i].toLowerCase()}.jpg`,
(err) => { console.log(err) }); // eslint-disable-line
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment