Skip to content

Commit

Permalink
Legg til foto banner-bilde for data-portal (#512)
Browse files Browse the repository at this point in the history
* Bilder på typeinndeling

* Reservebilder også for kataloger uten data

* Legg til banner-bilde for data-portal
  • Loading branch information
bjornreppen authored Mar 29, 2019
1 parent dcb9b6f commit 007578d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions steg/15/metabase_bilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ Object.keys(full).forEach(kode => {
const filer = filindeks[node.url]
node.foto = node.foto || {}
if (!filer) return
if (kode == "NN-NA") debugger
const forside = filer["forside_408.jpg"] || filer["forside_408.png"]
if (!forside) return
node.foto.forside = {
url: baseUrl + node.url + "/" + forside.filename,
if (kode == "NN-LA-KLG-REIA") debugger
add(filer, node, "forside", 408)
add(filer, node, "banner", 950)
// TODO: temp fallback
if (!node.banner && node.forside) node.banner = node.forside
})

function add(filer, node, tag, width) {
const basename = "forside_" + width
const imgfile = filer[basename + ".jpg"] || filer[basename + ".png"]
if (!imgfile) return
node.foto[tag] = {
url: baseUrl + node.url + "/" + imgfile.filename,
lisens: "",
opphav: "",
utgiver: ""
}
})
}

io.skrivDatafil(__filename, full)

0 comments on commit 007578d

Please sign in to comment.