I need to set og properties dynamically for facebook as below code,
<head>
....
<meta property="og:image" content="{{ url('homepage') }}uploads/media/images/article/{{ post.postImage1 }}" />
....
</head>
But {{ post.postImage1 }} returns file name ( I can see it in view source ) which is come from DB ( via controller ). But in Facebook Open Graph Object Debugger not showing it and Image is not loading. How to fix this.
Related
I’m trying to create a Single page with astro and netlify cms, in which the admin should be able to add/remove/modify the page through /admin, but I’m struggling with the understanding of the folder structure.
So, as far as I know, I need to specify the collection structure in the config.yml file. Something like this. (see attached file)
Which will create a content.md file. Basically it will contain all the info that was created through /admin.
The problem is that I don’t know how and where this content.md file is used. Should I import it manually in the index.astro file or am I wrong?
Thank you in advance 🙂
If you have a Markdown file at src/content/content.md, you will need to import and render it somewhere. It depends which page you want to display this content on, but if you want to show the content on your homepage, this would be src/pages/index.astro.
Here’s an example:
---
// src/pages/index.astro
import { Content, frontmatter } from '../content/content.md';
---
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>My homepage</title>
</head>
<body>
<h1>{frontmatter.title}</h1>
<article>
<Content /> <!-- this will render your Markdown body -->
</article>
</body>
</html>
The key things to note here are:
The use of the <Content /> component to render the main Markdown content of your Markdown file
The use of an expression {frontmatter.title} to access the title field from your Netlify CMS config. Other fields would be available in the same way: {frontmatter.description}, {frontmatter.heroImage} etc.
I trying to use the Docusign REST api to retrieve a page image from a specified envelope.
Using the GetDocumentPageImage api call specified in the docusign's developer resources:
https://docs.docusign.com/esign/restapi/Envelopes/Envelopes/getDocumentPageImage/
When I make a call, I receive in the response header:
content-type:image/png
When I save the raw binary to disk and try to open it, it doesn't seem to be a PNG file. Opening the file a text editor to inspect the contents shows that th file begins with:
˝PNG IHDR...
which seems to be a valid PNG file header, but ends with:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Image</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<meta name="robots" content="noindex, noarchive" />
</HEAD>
<body MS_POSITIONING="GridLayout">
<form method="post" action="./image.aspx" id="Form1">
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTUxMTcwNzgxMGRkQRcFn//jRJ+06xbvFxUi4rKEZIQb6fRuQKDtT8P6CNnm/JfLfRFk+peLPbzp4xXAtupqCca4iRWWnIYdQRieIA==" />
<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="40952B3F" />
</form>
</body>
</HTML>
I tried to strip the end part of the file that has the Microsoft rubbish with no luck. It seems the response content has been encoded differently some way and the docs don't explain what this is and how to decode.
I'm trying to get the markup correct for Gmail inbox actions for resetting a password. I'm using the Email Markup Tester.
My markup looks like this:
<div itemscope itemtype="http://schema.org/EmailMessage">
<meta itemprop="description" content="Reset password instructions"/>
<div itemprop="potentialAction" itemscope itemtype="http://schema.org/ViewAction">
<meta itemprop="target" content="https://www.example.com/users/password/new?token=123"/>
<meta itemprop="name" content="Reset Your Password"/>
</div>
<meta itemprop="description" content="Visit our site to reset your password."/>
</div>
The above markup returns the error:
A value for the url field is required.
But I can't figure out how that url field should be inserted into the markup. Even Google's example fails their markup validator.
(Not sure if this is just an error with their testing tool, or if this is really a new requirement that’s not documented.)
You could provide the url property in addition to the target property. Also note that you have to use a link element (instead of a meta element) if the value is a URL.
So it would be:
<link itemprop="target url" href="https://www.example.com/users/password/new?token=123" />
This reports no errors in Google’s email markup tester.
I am Using Google Picker api to access my google drive folder's files. The following html page uses picker to load my google docs. However after I select a doc and press select option the picker dialog box is not closing. nor even when I press the close button on the right top of the iframe. I think the problrm is in the picker call back but I don't know how to recitfy this. I include the html page here.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Picker Example</title>
<!-- The standard Google Loader script. -->
<script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
// Use the Google Loader script to load the google.picker script.
// google.setOnLoadCallback(createPicker);
google.load('picker', '1');
// Create and render a Picker object for searching images.
function createPicker() {
var picker = new google.picker.PickerBuilder().
addView(google.picker.ViewId.DOCS).
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
// A simple callback implementation.
function pickerCallback(data) {
var url = 'nothing';
if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {
var doc = data[google.picker.Response.DOCUMENTS][0];
url = doc[google.picker.Document.URL];
}
var message = 'You picked: ' + url;
document.getElementById('result').innerHTML = message;
}
</script>
</head>
<body>
<div id="result">
<button onclick="createPicker()">Upload Files </button>
<iframe></iframe>
</div>
</body>
</html>
The Picker requires some cross-domain communication that cannot be done if you open the page locally (e.g. open the html file from your disk).
Host the same page on a web server and it should work as expected.
The problem is that i didnt use a google api key to authenticate my communicating with google...Once the close is activated it calls pickercallback with a json file provided by google... which is not authenticated when i dont have a key...
The problem is with this line...
<script src="http://www.google.com/jsapi"></script>
It should be like ..
<script src="http://www.google.com/jsapi?key=#########################"></script>
replace #'s with your google api console key....you can generate a key here https://code.google.com/apis/console/
I'm trying to publish check-ins to places that aren't available on Facebook. I created a sample web page for a sample place and added the open graph metadata, but Facebook doesn't recognize my "og:type" correctly; it always crawls my page as an "og:type" "website", which marks my place-related metadata (e.g. latitude, longitude, city) as extraneous properties and, consequently, makes my page ID as an incorrect ID for a check-in.
My question is: how can I make my web page "represent" a place in "Facebook compliant" open graph metadata? How can I make a web page that is a valid check-in place?
This is the og metadata that I'm using:
<html version="XHTML+RDFa 1.1" xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://ogp.me/ns#" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="pt" lang="pt" dir="ltr">
<head>
<title>A Bateira</title>
<meta content="http://farm5.static.flickr.com/4152/5095614606_f6620d7b54.jpg" property="og:image" />
<meta content="40.643696" property="og:latitude" />
<meta property="og:type" content="cafe" />
<meta content="-8.655696" property="og:longitude" />
<meta property="og:street-address" content="Cais dos Botiroes" />
<meta property="og:locality" content="Aveiro" />
<meta property="og:region" content="Aveiro" />
<meta property="og:postal-code" content="3810" />
</head>
Best Regards,
P.
You can't currently write checking to Open Graph Places (i.e URLs)
At the moment you can check a user in to a Facebook place by POSTing to:
https://graph.facebook.com/me/checkins?place_id=FACEBOOK_PLACE_ID&access_token=TOKEN&coordinates=COORDS_JSON_OBJ
See: https://developers.facebook.com/docs/reference/api/user/ You need the publish_checkins permission for this.
This may change in the future, as checkins are becomming an annotation of the post object.
In the meantime, you can create a custom Cafe object and a custom Checkin action and post your own custom checkin actions to your own custom lat/long-tagged objects