diff --git a/App.js b/App.js
index b9f59849..76613b79 100644
--- a/App.js
+++ b/App.js
@@ -20,7 +20,6 @@ import AccueilEn from './Accueil.en'
import Blog from './Blog'
import Communs from './Communs'
import Action from './Action'
-import Article from './Article'
import Ecosystem from './Ecosystem'
import About from './About'
@@ -58,9 +57,6 @@ const Container = () => (
-
-
-
diff --git a/Article.js b/Article.js
index 0dc52b98..619d4d5b 100644
--- a/Article.js
+++ b/Article.js
@@ -12,9 +12,12 @@ const getLastEdit = (name, action) =>
)
.then((res) => res.json())
.then((json) => {
- const date = json[0].commit.committer.date
-
- action(dateCool(new Date(date)))
+ try {
+ const date = json[0].commit.committer.date
+ action(dateCool(new Date(date)))
+ } catch (e) {
+ console.log(e)
+ }
})
export const imageResizer = (size) => (src) =>
@@ -28,21 +31,31 @@ export default ({}) => {
const { id } = useParams(),
article = articles.find((a) => a.id === id),
{
- attributes: { image, auteur, date },
+ attributes: { image, titre, auteur, date },
body,
- } = article
+ } = article,
+ // imported articles from wordpress have english attributes
+ author = auteur || article.attributes.author,
+ title = titre || article.attributes.title,
+ year = new Date(date).getFullYear()
const [lastEditDate, setLastEditDate] = useState(null)
getLastEdit(id, setLastEditDate)
return (
articleStyle}>
-
(image)})
+ {image && (
+
(image)})
+ )}
+ {title &&
{title}
}
@@ -56,16 +69,23 @@ export default ({}) => {
border-radius: 0.3rem;
`}
>
- {auteur}
+ {author}
- le {dateCool(date)}, mis à jour le{' '}
-
- {lastEditDate}
-
+ le {dateCool(date)}
+ {lastEditDate && (
+
+ , mis à jour le{' '}
+
+ {lastEditDate}
+
+
+ )}
@@ -73,7 +93,7 @@ export default ({}) => {
Venez discuter de cet article{' '}