~bfluhr/website

e2c1277dd29dd1ddc9582f6f711cb722fa0040ce — Benedikt Fluhr 2 years ago 7b6fb27
Adding Viewport Meta Tags in 'build.ts'
1 files changed, 12 insertions(+), 1 deletions(-)

M util/build.ts
M util/build.ts => util/build.ts +12 -1
@@ 48,11 48,13 @@ const process = async function(processing_started, to_process) {
	processing_started.push(path);
	if (path.endsWith('.html')) {
	    const doc = await getDoc(path, credentials);
	    const head = doc.querySelector('head');
	    const meta_viewport = doc.createElement('meta');
	    meta_viewport.setAttribute('name', 'viewport');
	    if (getContentLoc(path) === 'webspace') {
		// Remove Redundant 'div'
		doc.querySelector('div.titlepage')?.remove();

		const head = doc.querySelector('head');
		// Fix Character Encoding
		doc.querySelector('meta').remove();
		const meta = doc.createElement('meta');


@@ 78,7 80,16 @@ const process = async function(processing_started, to_process) {
		    .forEach(script_tag => script_tag.remove());
		head.appendChild(mathjax_script_tags[0]);
		head.appendChild(mathjax_script_tags[1]);
		// Viewport
		meta_viewport.setAttribute(
		    'content', 'width=743, initial-scale=1'
		);
	    } else {
		meta_viewport.setAttribute(
		    'content', 'width=device-width, initial-scale=1'
		);
	    }
	    head.appendChild(meta_viewport);
	    const ref_paths = getRefPaths(
		pubignore, processing_started.concat(to_process), path, doc
	    );