#29 - Avoir un titre distinct par page #34

Merged
dbroqua merged 1 commit from issue/29 into develop 2022-03-06 15:11:43 +01:00
9 changed files with 28 additions and 1 deletions
Showing only changes of commit dd7bb6e21a - Show all commits

View file

@ -196,6 +196,7 @@ SECRET # Hash utilisé pour pour sauvegardé les dessions (par défaut waemaeMe5
DISCOGS_TOKEN # Token Discogs (vous devez créer un compte sur discogs afin d'en obtenir un gratuitement)
FORMSPREE_ID # Id du formulaire formspree pour la page "nous-contacter"
MATOMO_URL # Url vers l'instance matomo (exemple: https://analytics.darkou.fr/)
SITE_NAME # Nom du site (utilisé dans le titre des pages)
```
## Contributeurs

View file

@ -26,6 +26,7 @@ services:
DISCOGS_TOKEN: ${DISCOGS_TOKEN}
FORMSPREE_ID: ${FORMSPREE_ID}
MATOMO_URL: ${MATOMO_URL}
SITE_NAME: ${SITE_NAME}
networks:
- musictopus
musictopus-db:

View file

@ -26,6 +26,7 @@ services:
DISCOGS_TOKEN: ${DISCOGS_TOKEN}
FORMSPREE_ID: ${FORMSPREE_ID}
MATOMO_URL: ${MATOMO_URL}
SITE_NAME: ${SITE_NAME}
networks:
- musictopus
musictopus-db:

View file

@ -6,4 +6,5 @@ module.exports = {
discogsToken: process.env.DISCOGS_TOKEN,
formspreeId: process.env.FORMSPREE_ID,
matomoUrl: process.env.MATOMO_URL || "",
siteName: process.env.SITE_NAME || "MusicTopus",
};

View file

@ -641,6 +641,7 @@ class Albums extends Pages {
this.setPageContent("artists", artists);
this.setPageContent("formats", formats);
this.setPageTitle("Ma collection");
}
/**
@ -655,6 +656,9 @@ class Albums extends Pages {
});
this.setPageContent("item", item);
this.setPageTitle(
`Détails de l'album ${item.title} de ${item.artists_sort}`
);
}
/**
@ -676,6 +680,7 @@ class Albums extends Pages {
const formats = await Albums.getAllDistincts("formats.name", userId);
this.setPageContent("username", user.username);
this.setPageTitle(`Collection publique de ${user.username}`);
this.setPageContent("artists", artists);
this.setPageContent("formats", formats);
}

View file

@ -34,6 +34,10 @@ class Pages {
}
}
setPageTitle(title) {
this.pageContent.page.title = title;
}
setPageContent(field, value) {
this.pageContent.page[field] = value;
}

View file

@ -14,6 +14,8 @@ router.route("/").get((req, res, next) => {
try {
const page = new Pages(req, "home");
page.setPageTitle("Présentation du projet");
render(res, page);
} catch (err) {
next(err);
@ -26,6 +28,8 @@ router
try {
const page = new Pages(req, "connexion");
page.setPageTitle("Connexion");
render(res, page);
} catch (err) {
next(err);
@ -61,6 +65,8 @@ router
try {
const page = new Pages(req, "inscription");
page.setPageTitle("Inscription");
render(res, page);
} catch (err) {
next(err);
@ -82,6 +88,8 @@ router
try {
const page = new Pages(req, "ajouter-un-album");
page.setPageTitle("Ajouter un album");
render(res, page);
} catch (err) {
next(err);
@ -92,6 +100,8 @@ router.route("/nous-contacter").get(async (req, res, next) => {
try {
const page = new Pages(req, "nous-contacter");
page.setPageTitle("Nous contacter");
render(res, page);
} catch (err) {
next(err);
@ -102,6 +112,8 @@ router.route("/composants").get(async (req, res, next) => {
try {
const page = new Pages(req, "composants");
page.setPageTitle("Les composants");
render(res, page);
} catch (err) {
next(err);

View file

@ -30,6 +30,8 @@ router
try {
const page = new Albums(req, "mon-compte/ma-collection/exporter");
page.setPageTitle("Exporter ma collection");
render(res, page);
} catch (err) {
next(err);

View file

@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><% if (page.title) { %><%= page.title %> <% } else { %> DarKou - MusicTopus <% } %></title>
<title><%= config.siteName %> :: <%= page.title %></title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">