How can I get Pelican to use the save_as meta to also populate the canonical og:url head info? - pelican

Using current Pelican and the pelican-bootstrap3 theme.
Currently I use save_as to set the article which should be the current landing page.
When I do that Facebook throws an error because the canonical url isn't there.
So if the normal URL would be https://some.site/my_page.html but the save_as yields https://some.site/index.html
My .rst file meta
:save_as: index.html
The header contains.
<head>
<title>My Page</title>
<!-- Using the latest rendering mode for IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="/my_page.html">
<meta name="author" content="me" />
<meta name="keywords" content="my_page" />
<meta name="description" content="Stuff" />
<meta property="og:site_name" content="Stuff" />
<meta property="og:type" content="article"/>
<meta property="og:title" content="my_pagee"/>
<meta property="og:url" content="/my_page.html"/>
<meta property="og:description" content="Stuff"/>
<meta property="article:published_time" content="2020-03-20" />
<meta property="article:section" content="covid-19" />
<meta property="article:tag" content="Stuff" />
<meta property="article:author" content="me" />
<!-- Bootstrap -->
<link rel="stylesheet" href="/theme/css/bootstrap.min.css" type="text/css"/>
<link href="/theme/css/font-awesome.min.css" rel="stylesheet">
<link href="/theme/css/pygments/native.css" rel="stylesheet">
<link rel="stylesheet" href="/theme/css/style.css" type="text/css"/>
<link href="/css/hpt.css" rel="stylesheet">
</head>
Ideally pelican would save the page to the "normal" URL and to the save_as, or change the canonical URL to be the save_as

You have to go to the template which has the og:url meta and set a jinja2 statement like this:
{% if page.save_as %}
<meta property="og:url" content="/{{ page.save_as }}"/>
{% else %}
<meta property="og:url" content="/{# the previous statement of the theme #}"/>
{% endif %}

Related

How to modify the index html in vue cli?

I want to modify the index html during the vue cli build process. (vue.config.js)
Is there any way to do this?
This is my index html looks like:
<!DOCTYPE html>
<html lang="en">
<head>
<%= foo %>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<meta charset="utf-8" />
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
<title>blabla</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=5, minimal-ui" />
</head>
<body>
<noscript>
<strong>We're sorry but tera.com-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
</body>
</html>
and I want vue/webpack to parse the value 1 to foo.
Vue will attach to the DIV with id app. So your {{foo}} will be out of range for Vue to change it.
You should look into Single File Components, that way you'll be able to wrap your whole HTML inside Vue.

Adding Text Information in Html Head

This could be something very simple, but I am having a hard time with this. I have to add some additional information into the heading information of a page. The issue is that the information always ends up in the body instead of heading.
Here is the sample code
#{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<text id="test">
//Wish to add some additional information here
tester
</text>
<title>Test Heading</title>
</head>
<body>
</body>
</html>
#{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Test Heading</title>
<meta name="description" content="Latest sports news and live scores from Yahoo! Eurosport UK. Complete sport coverage with Football results, Cricket scores, F1, Golf, Rugby, Tennis and more.">
<meta name="keywords" content="eurosport,sports,sport,sports news,live scores,football,cricket,f1,golf,rugby,tennis,uk,yahoo">
</head>
<body>
</body>
</html>
The customer is forcing the browser to behave like IE8; as a result, adding an xml tag in the heading works. Adding a line for IE8 compatibility did the trick for them.
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8;" />
<meta name="viewport" content="width=device-width" />
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<text id="students">
<name>Name</name>
<sCode>122</sCode>
</text>
<title>Test Heading</title>
</head>
<body>
</body>
</html>

I'm trying to attach this php code to html file and cant figure out

php require('includes/config.php');
if(!$user->is_logged_in()){ header('Location: login.php'); }
$title = 'main';
require('layout/header.php');
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href=
'http://fonts.googleapis.com/css?family=Lora:400,700|Open+Sans:400,300,700'
rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="css/reset.css" type="text/css" />
<!-- CSS reset -->
<link rel="stylesheet" href="css/style.css" type="text/css" />
<!-- Resource style -->
<script src="js/modernizr.js" type="text/javascript">
<title>
main menuw
</title>
PHP code should be between the '<?php' and '?>'
Your server should support PHP

open graph protocol for google plus

<!DOCTYPE html>
<html lang="en-US"
xmlns:fb="http://ogp.me/ns/fb#" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta property="og:image" content="http://www.98quotes.com/wp-content/uploads/2013/11/mysis2-300x300.gif"/>
<!-- This site is optimized with the Yoast WordPress SEO plugin v1.4.22 - http://yoast.com/wordpress/seo/ -->
<title>sister love1 - 98Quotes</title>
<link rel="canonical" href="http://www.98quotes.com/sister-love1/" />
<meta property="og:locale" content="en_US" />
<meta property="og:type" content="article" />
<meta property="og:title" content="sister love1 - 98Quotes" />
<meta property="og:description" content="Search TagX on Google View all posts tagged as Tagx Find TagX related info in WikiPedia I love my sister Your sister isn’t always your blood relation. Sometimes it’s that close friends who understands you, loves you and has always got your back. If you have a loving sister or someone in your life you …" />
<meta property="og:url" content="http://www.98quotes.com/sister-love1/" />
<meta property="og:site_name" content="98Quotes" />
<meta property="article:tag" content="I Love You" />
<meta property="article:tag" content="Sister" />
<meta property="article:section" content="Relationship" />
<meta property="article:published_time" content="2013-11-07T12:20:10+00:00" />
<meta property="og:image" content="http://www.98quotes.com/wp-content/uploads/2013/11/mysis2.gif" />
<meta name="twitter:card" content="summary"/>
<meta name="twitter:domain" content="98Quotes"/>
<!-- / Yoast WordPress SEO plugin. -->
my page head is as above.. but still google+ unable to fetch content, though it fetch the image. Can any body tell me what is the reason for it.
The +Snippet description/preview is now only displayed on Google+ if you use interactive shares.

BeatifulSoup4 closes common meta and link tags in the head

<head>
<meta name="description" content="Our description">
<meta name="keywords" content="our keywords">
<link rel="stylesheet" href="/IN/style.css" type="text/css">
</head
Becomes
<head>
<meta name="description" content="Our description">
<meta name="keywords" content="our keywords">
<link rel="stylesheet" href="/IN/style.css" type="text/css">
</link>
</meta>
</meta>
</head>
Multiplied by all the tags in the head it starts to get ridiculous. Making the tags self-closing prevents the behavior, but to the extent the behavior is common (this very site, arstechnica, theverge) I think there should be a workaround to disable the behavior. Is there?