add title for cv html
This commit is contained in:
parent
81f8198591
commit
2058f72ba2
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>CV</title>
|
||||
<title><%= fn.getCVTitle(cv) %></title>
|
||||
<style>
|
||||
/* styles here should be removed in @media print */
|
||||
body {
|
||||
|
|
|
|||
|
|
@ -5,11 +5,17 @@ import {
|
|||
getCVSavedTime,
|
||||
} from '../lib/store';
|
||||
import { applyThemeTo } from '../themes';
|
||||
import { getCVTitle } from '../themes/data';
|
||||
|
||||
const themeName = 'default'
|
||||
const elCV = document.querySelector('.cv-container')
|
||||
|
||||
applyThemeTo(themeName, elCV, getCVData())
|
||||
const data = getCVData()
|
||||
if (data) {
|
||||
applyThemeTo(themeName, elCV, data)
|
||||
// change document title
|
||||
document.title = getCVTitle(data)
|
||||
}
|
||||
|
||||
const savedTime = getCVSavedTime()
|
||||
console.log('preview loaded', Date.now())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export function getRenderData(cvData) {
|
|||
return {
|
||||
cv: cvData,
|
||||
fn: {
|
||||
getCVTitle,
|
||||
reformatDate,
|
||||
getIconSVG,
|
||||
noSchemaURL,
|
||||
|
|
@ -14,6 +15,12 @@ export function getRenderData(cvData) {
|
|||
|
||||
/* fn */
|
||||
|
||||
export function getCVTitle(cv) {
|
||||
let {name, version} = cv.meta
|
||||
if (!name) name = cv.basics.name || 'JSONCV'
|
||||
return `${name}${version ? ' ' + version : ''}`
|
||||
}
|
||||
|
||||
function noSchemaURL(url) {
|
||||
url = url.replace(/https?:\/\//, '')
|
||||
if (url.endsWith('/')) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue