Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display structured contacts metadata field #1638

Merged
merged 1 commit into from
Sep 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion content/0examples/non-vue/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ date: 2021-04-25
days: 1
continent: EU
contact: Strong Mad
contact_url: https://example.com
contacts:
- name: Person
email: [email protected]
url: https://example.com
authors: Marzipan
location:
name: Strong Badia
Expand Down
5 changes: 4 additions & 1 deletion content/0examples/vue-remark/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ date: 2021-04-25
days: 2
continent: EU
contact: people
contact_url: https://example.com
contacts:
- name: Person
email: [email protected]
url: https://example.com
authors: Jose and me
location:
name: Strong Badia
Expand Down
9 changes: 5 additions & 4 deletions src/components/ArticleHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@
<a v-if="article.location.url" :href="article.location.url">{{ article.location.name }}</a>
<template v-else>{{ article.location.name }}</template>
</li>
<li v-if="article.contact">
<li v-if="article.contact || article.contacts">
<span class="metakey">Contact: </span>
<a v-if="article.contact_url" :href="article.contact_url">{{ article.contact }}</a>
<template v-else>{{ article.contact }}</template>
<Contacts :contact="article.contact" :contacts="article.contacts" />
</li>
<li v-if="article.links.length > 0">
<span class="metakey">Links: </span>
Expand All @@ -46,6 +45,7 @@

<script>
import Redirect from "@/components/Redirect";
import Contacts from "@/components/Contacts";
import { ensureDomain, humanDateSpan } from "~/lib/utils.js";
import { getImage } from "~/lib/pages.mjs";
import CONFIG from "~/../config.json";
Expand All @@ -58,6 +58,7 @@ const SOCIAL_TAGS_METADATA = [
export default {
components: {
Redirect,
Contacts,
},
metaInfo() {
let info = {};
Expand Down Expand Up @@ -123,7 +124,7 @@ export default {
return dayjs(this.article.end);
},
articleDateStr() {
return this.startDate.format("MMMM D YYYY");
return this.startDate.format("MMMM D, YYYY");
},
image() {
return getImage(this.article.image, this.article.images);
Expand Down
4 changes: 3 additions & 1 deletion src/components/ArticleTableEvents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@
title="Training offered by GTN Member"
/>
</a>
{{ article.contact }}
<Contacts :contact="article.contact" :contacts="article.contacts" />
</td>
</tr>
</template>

<script>
import Continent from "@/components/Continent";
import Contacts from "@/components/Contacts";
export default {
components: {
Continent,
Contacts,
},
props: {
article: { type: Object, required: true },
Expand Down
23 changes: 23 additions & 0 deletions src/components/Contacts.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<template>
<span>
<template v-if="contact">
{{ contact }}
</template>
<template v-else-if="contacts && contacts.length > 0" v-for="(thisContact, i) of contacts">
<a v-if="thisContact.email" :href="`mailto:${thisContact.email}`" :key="thisContact.email">
{{ thisContact.name }}</a
><a v-else-if="thisContact.url" :href="thisContact.url" :key="thisContact.url"> {{ thisContact.name }}</a
><template v-else> {{ thisContact.name }}</template
><template v-if="i < contacts.length - 1">, </template>
</template>
</span>
</template>

<script>
export default {
props: {
contact: { type: String, required: false, default: "" },
contacts: { type: Array, required: false, default: () => [] },
},
};
</script>
5 changes: 5 additions & 0 deletions src/components/pages/Events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ fragment articleFields on Article {
}
continent
contact
contacts {
name
email
url
}
external_url
gtn
links {
Expand Down
5 changes: 5 additions & 0 deletions src/components/pages/EventsArchive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ query($subsite: String, $mainPath: String, $footerPath: String) {
}
continent
contact
contacts {
name
email
url
}
external_url
gtn
links {
Expand Down
5 changes: 5 additions & 0 deletions src/components/pages/TaggedEvents.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ fragment articleFields on Article {
}
continent
contact
contacts {
name
email
url
}
external_url
gtn
links {
Expand Down
6 changes: 5 additions & 1 deletion src/templates/Article.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ query Article($path: String!) {
date (format: "YYYY-MM-DD")
end (format: "YYYY-MM-DD")
contact
contact_url
contacts {
name
email
url
}
authors
location {
name
Expand Down
6 changes: 5 additions & 1 deletion src/templates/VueArticle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ query VueArticle($path: String!) {
date (format: "YYYY-MM-DD")
end (format: "YYYY-MM-DD")
contact
contact_url
contacts {
name
email
url
}
authors
location {
name
Expand Down