Skip to content

Commit 5bdf972

Browse files
committed
pwa and birthday icon
1 parent 19998d9 commit 5bdf972

10 files changed

+1015
-160
lines changed

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.5.3

components/Periodical.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88
<div class="Periodical-title">{{ issue.fields['Name'] }}</div>
99
<div class="Periodical-date _right-sm">{{ issue.fields['Date'] | niceDate }}</div>
1010
</div>
11-
<div class="Periodical-description _margin-bottom-2" v-html="$md.render(issue.fields['Markdown'])"></div>
11+
<div class="Periodical-description _margin-bottom-2" v-html="$md.render(issue.fields['Markdown'] || '')"></div>
1212

1313
<div class="Periodical-updates" v-if="getUpdates(issue)">
1414
<h5 class="Periodical-updates-title">{{issue.fields['UpdatesTitle'] || 'What’s New'}}</h5>
1515
<div class="Periodical-update-item _margin-bottom" v-for="update of getUpdates(issue)" :key="update.fields['Name']" v-if="update && update.fields['isPublished']">
16-
<div class="_md-p_fix" v-html="$md.render(update.fields['Markdown' || ''])"></div>
16+
<div class="_md-p_fix" v-html="$md.render(update.fields['Markdown'] || '')"></div>
1717
<div class="_margin-top-half" v-if="update.fields['Tags']">
1818
<span class="Periodical-item-tag _tag" :class="tag == 'Sponsor' ? '--sponsor' : ''" v-for="tag of update.fields.Tags" :key="tag">{{ tag }}</span>
1919
</div>
2020
</div>
2121
</div>
2222

23-
<div class="Periodical-content" v-if="issue.fields['ArticleContent']" v-html="$md.render(issue.fields['ArticleContent'])">
23+
<div class="Periodical-content" v-if="issue.fields['ArticleContent']" v-html="$md.render(issue.fields['ArticleContent'] || '')">
2424
</div>
2525

2626
<!-- list has been moved to PeriodicalList.vue -->
@@ -78,7 +78,7 @@ export default {
7878
},
7979
getArticleName(article) {
8080
if(article.fields['MdTitle'])
81-
return this.$md.render(article.fields['MdTitle'])
81+
return this.$md.render(article.fields['MdTitle'] || '')
8282
else
8383
return article.fields['Name']
8484
},

nuxt.config.js

+70-32
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const airtable_base = 'appSCAap8SWbFRtu0';
3232

3333
let mode = 'universal' // loads airtable dynamically
3434
// const mode = 'universal' // loads airtable during build-time only (any changes to airtable won't be reflected live)
35-
if (process.env.NODE_ENV == 'production') {
35+
if (process.env.NODE_ENV == 'spa') {
3636
mode = 'spa'
3737
// mode = 'universal'
3838
}
@@ -251,31 +251,69 @@ module.exports = {
251251
id: site_ga,
252252
// disabled: true // gdpr, policy.js enables it: https://medium.com/dailyjs/google-analytics-gdpr-and-vuejs-e1bd6affd2b4
253253
}],
254-
['@nuxtjs/markdownit', {
255-
html: true,
256-
}],
254+
// ['@nuxtjs/markdownit', {
255+
// html: true,
256+
// }],
257257
['@nuxtjs/google-tag-manager', {
258258
id: 'GTM-WCR3X43'
259259
}],
260+
'@nuxtjs/pwa',
261+
'nuxt-device-detect',
260262
],
261-
markdownit: {
262-
// preset: 'default',
263-
injected: false, // markdownit.js plugin takes over injection
264-
// to use custom injection, remove if (_options.injected === true) { block from @nuxtjs/markdownit/index.js
265-
// use the custom plugin/markdownit to inject properly; the official thing is broken
266-
// injected: true, // commented out to allow attrs in lang="md" blocks
267-
// BUG: in @nuxtjs/markdownit/index.js: this needs to be set:
268-
// options: Object.assign({}, options, this.options.markdownit)
269-
// this allows lang="md" to continue processing plugins like markdown-it-attrs, otherwise it doesn't do that anymore
270-
// otherwise plugins will break
271-
html: true,
272-
typographer: true,
273-
linkify: true,
274-
breaks: true,
275-
use: [
276-
'markdown-it-attrs',
277-
['markdown-it-attrs', {'leftDelimiter': '[', 'rightDelimiter': ']'}]
278-
],
263+
// this is buggy, using own plugin instead
264+
// markdownit: {
265+
// // preset: 'default',
266+
// injected: false, // markdownit.js plugin takes over injection
267+
// // to use custom injection, remove if (_options.injected === true) { block from @nuxtjs/markdownit/index.js
268+
// // use the custom plugin/markdownit to inject properly; the official thing is broken
269+
// // injected: true, // commented out to allow attrs in lang="md" blocks
270+
// // BUG: in @nuxtjs/markdownit/index.js: this needs to be set:
271+
// // options: Object.assign({}, options, this.options.markdownit)
272+
// // this allows lang="md" to continue processing plugins like markdown-it-attrs, otherwise it doesn't do that anymore
273+
// // otherwise plugins will break
274+
// html: true,
275+
// typographer: true,
276+
// linkify: true,
277+
// breaks: true,
278+
// use: [
279+
// 'markdown-it-attrs',
280+
// ['markdown-it-attrs', {'leftDelimiter': '[', 'rightDelimiter': ']'}]
281+
// ],
282+
// },
283+
284+
285+
manifest: {
286+
name: 'Phage Directory',
287+
short_name: 'phagedirectory',
288+
display: 'standalone',
289+
start_url: 'https://phage.directory/',
290+
theme_color: site_color,
291+
background_color: '#FFFFFF',
292+
lang: 'en',
293+
// icons: PWAIcons
294+
},
295+
296+
workbox: {
297+
runtimeCaching: [
298+
{
299+
urlPattern: 'https://api.airtable.com/v0/appSCAap8SWbFRtu0/.*',
300+
handler: 'cacheFirst',
301+
method: 'GET',
302+
strategyOptions: {cacheableResponse: {statuses: [0, 200]}}
303+
},
304+
// {
305+
// urlPattern: 'https://fonts.googleapis.com/.*',
306+
// handler: 'cacheFirst',
307+
// method: 'GET',
308+
// strategyOptions: {cacheableResponse: {statuses: [0, 200]}}
309+
// },
310+
// {
311+
// urlPattern: 'https://fonts.gstatic.com/.*',
312+
// handler: 'cacheFirst',
313+
// method: 'GET',
314+
// strategyOptions: {cacheableResponse: {statuses: [0, 200]}}
315+
// },
316+
]
279317
},
280318

281319
build: {
@@ -383,11 +421,11 @@ module.exports = {
383421
path: '/antibiotics',
384422
component: resolve(__dirname, 'pages/dir.vue')
385423
},
386-
{
387-
name: 'orgs',
388-
path: '/orgs',
389-
component: resolve(__dirname, 'pages/dir.vue')
390-
},
424+
// {
425+
// name: 'orgs',
426+
// path: '/orgs',
427+
// component: resolve(__dirname, 'pages/dir.vue')
428+
// },
391429
{
392430
name: 'labs',
393431
path: '/labs',
@@ -405,11 +443,11 @@ module.exports = {
405443
// },
406444

407445
// news alerts
408-
{
409-
name: 'alerts',
410-
path: '/alerts/:id',
411-
component: resolve(__dirname, 'pages/alerts.vue')
412-
},
446+
// {
447+
// name: 'alerts',
448+
// path: '/alerts/:id',
449+
// component: resolve(__dirname, 'pages/alerts.vue')
450+
// },
413451

414452

415453
// blog / news / 'viral' newsletter; resolves to generic Blog page

0 commit comments

Comments
 (0)