I am new to the pubsub service and no matter what I tried in the website or java sample I couldn't make it work.
I opened this link https://cloud.google.com/pubsub/reference/rest/v1beta2/projects/subscriptions/create
Then turned on "Authorize requests using OAuth 2.0"
Then wrote "aaa" in the name field and clicked on execute.
The result was as followed (the same result I got in the java App)
<!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 404 (Not Found)!!1</title>
<style>
*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}#media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}#media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/errors/logo_sm_2_hr.png) 0}}#media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}
</style>
<a href=//www.google.com/><span id=logo aria-label=Google></span></a>
<p><b>404.</b> <ins>That’s an error.</ins>
<p>The requested URL <code>/v1beta2/aaa?key=****************;alt=json</code> was not found on this server. <ins>That’s all we know.</ins>
The name should be in the following form:
projects/PROJECT_ID/topics/TOPIC_NAME
The format in create topic in v1beta2:
name in url like: projects/{pojectId}/topics/{your-cool-name}
Inside the post the name have another format:
{
name = '/topics/{projectId}/{your-cool-name}'
}
Related
I am driving crazy with this thing.
I am running a SPA in React, working fine on several hundreds of servers.
On a specific server of one of my customers (I mean: just one single server) there is a weird problem with svgs, let me explain.
The svg icons are in the DOM, but they don't show up. The svg tag is not even recognized by the browser DOM.
svg not recognized
I found that, if I try to edit HTML via inspector by adding a space after tag, the svg become magically appears.
adding a space after
...tadaaaa! magic
I am using iconify for React for rendering the svgs.
I tried also to run on the server this simple html file:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>test</title>
</head>
<body>
<div id="app"></div>
</body>
<script>
const svg = `<svg xmlns="https://www.w3.org/2000/svg"
xmlns:xlink="https://www.w3.org/1999/xlink"
aria-hidden="true"
role="img"
class="iconify iconify--dashicons"
width="18px"
height="18px"
preserveaspectratio="xMidYMid meet"
viewbox="0 0 20 20"
style="color: rgb(0, 113, 174);"
>
<path fill="currentColor" d="M6 15V2h10v13H6zm-1 1h8v2H3V5h2v11z"></path>
</svg>`;
document.getElementById('app').innerHTML = svg;
</script>
</html>
And this works fine.
Anyone can undestand what's the problem on this server?
Thanks in advance
M
I'm trying to get preview of the page from different links within my react project but it's only showing the index.html "home" preview. I understand React is a SPA, but is there a module or a method to display previews/ thumbnails when I'm sharing/ posting these links? I'm using a headless CMS with Wordpress as the backend with API calls. I would like to post preview/ thumbnails of the articles/ etc.. I create.
example:
www.foxnews.com
there is a file called index.html in the public folder of react app
in there you should add meta property tags like this
<meta property="og:URL" content="%PUBLIC_URL%/localImage.jpg" />
<meta property="og:type" content="article" />
<meta property="og:title" content="lorem ipsum lorem ipsum" />
<meta property="og:description" content="lorem ipsum" />
<meta property="og:image" content="%PUBLIC_URL%/localImage.jpg" />
i had the same issue , and here is how i solved it
i've added the thumnail in page website
which can be access from the route (you want to give him a thumbnail)
make as the first element of your page (or at least your first picture )
because : the thumbnail link take the first picture of your website
and then with Css make sure that the picture doesn't appear
but ! WARNING ! don't do that :
display : none
because it will be as a removed pic and will not be considered
Here is an example of how i did that bellow !
in .jsx file of your page
<div className="thumbnail">
<img src="/thumbnails/landing.png" alt=""/>
</div>
here is the style in sass same as in css
.thumbnail
position : absolute
top : 0
z-index : -5000
width : 0px
height : 0px
img
object-fit : cover
width : 0px
height : 0px
to get the feature you need to paste the following markup to your html page in the head tag.
<meta property="og:title" content="title" />
<meta property="og:type" content="website">
<meta property="og:description" content="Content description />
<meta property="og:image" content="image you want to show here" />
<meta property="og:url" content="url ">
Having setup metatags for sharable pages via a heroku-hosted react web app. I've noticed that Twitter cards are not being properly presented, despite page source correctly presenting twitter and og meta data.
Given the below - Is there anything I haven't considered yet?
Javascript:
I have tested with javascript disabled, and the site still renders correctly, with correct meta tags
Image Size:
Is within defined limits - 434px X 650px, 94KB
Hosting:
Hosted on Herokuapp, the URL is still using the herokuapp domain (hasn't been switched to a production url)
expressFullURL : https://project.herokuapp.com/share/[ID]
Image Hosting:
Images are referencing AWS S3 buckets in the url https://media.project.aws/[etc]
Robots:
The site does not have a robots.txt file
Below, is the head meta content:
twitter.image URL is dynamically loaded in
twitter.url, which is also dynamic using express to generate the full URL (http://project.com/share/page/1234)
<!-- basic meta -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta charset="utf-8" />
<meta content="text/html; charset=UTF-8" name="Content-Type" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- content meta -->
<meta name="description" content="description content" />
<meta name="copyright" content="Copyright 2019" />
<!-- Twitter meta -->
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:site" content="#handle">
<meta property="twitter:image" content="${image.url}">
<meta property="twitter:card" content="summary_large_image">
<meta property="twitter:url" content="${expressFullURL}">
<meta property="twitter:title" content="Title">
<meta property="twitter:description" content="description content">
<!-- opengraph data -->
<meta property="og:title" content="Title" />
<meta property="og:description" content="description content" />
<meta property="og:url" content="${expressFullURL}" />
<meta property="og:image" content="${image.url}" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Site Name" />
Using https://cards-dev.twitter.com/validator
the response is:
INFO: Page fetched successfully
WARN: No metatags found
Meta is correct on page, so can't understand why no metatags can be found
I had a similar situation, but seem to have it working. I kept an eye on the Heroku logs heroku logs --tail while clicking the validator preview button. Turns out I was getting a 500 error from my app, because of the format of the request from the validator. Might be worth a check.
I made a couple of observations that I'd like to document as an answer here:
A <meta charset="utf-8"> tag is required.
The twitter:image tag needs a full HTTPS URL, like https://host.com/some/image.jpg.
The twitter card validator needs to be refreshed for each change. It is not enough to just click on the "Preview Card" button again, you need to reload the webpage (CMD-R on the Mac) and enter the card URL in the text field. Otherwise the validator doesn't seem to load the latest changes.
The error message"INFO: Page fetched successfullyWARN: No metatags found"is
completely misleading. It is shown even if the URL doesn't exist.
A minimum working example is:
<html>
<head>
<meta charset="utf-8">
<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="#username"/>
<meta name="twitter:title" content="A title"/>
<meta name="twitter:description" content="A description."/>
<meta name="twitter:image" content="https://host.com/some/image.jpg"/>
</head>
<body>
</body>
</html>
Based on superluminary response here I've set up an Angular 1 app without Hashbangs and html5Mode(true) and rely on Google to execute javascript. The page is being indexed by Google but dynamic titles and description tags are not.
My index.html head is the following:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="/">
<meta name="author" content="me">
<meta name="robots" content="index,follow">
<title ng-bind="meta.title">Temp Title</title>
<meta name="description" content="{{meta.description}}">
<!-- Scripts & CSS -->
</head>
The title and description are correctly loaded but they don't display on Google.
How can I do that?
Also does this technique works with Facebook and other social networks? Thank you.
Why you don't use something like that?
https://github.com/steeve/angular-seo
Actually superluminary response here has the solution. HTML page head must be sent fully resolved by the server.
So in order for this solution to work I was forced to replicate angular routes in the server side and send the info resolved.
Instead of using a plain html view I changed to .ejs and also changed the header to something like this:
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<base href="/">
<meta name="robots" content="index,follow">
<script type="text/javascript">
window.title = <%- JSON.stringify(precomposition) %>.title;
</script>
<title ng-bind="title"><%= precomposition.title %></title>
<meta name="description" content="<%= precomposition.description %>">
<!-- More meta information -->
<!-- Scripts & CSS -->
</head>
Now when the website gets a direct hit (initially resolved by the server instead of Angular, always the case for crawlers) I handle the request server side:
//Express route
app.route('/').get(precomposition.render);
//precomposition
exports.render = function (req, res) {
const precomposition = {title: 'tile', description: 'description'};
res.locals.precomposition = precomposition;
res.render('index.ejs');
};
If it's not a direct hit Angular handles the title update (because the other info is not displayed to the user).
It has off course some downsides but Google since October 2015 recommends this approach instead of "_escaped_fragment_ URLs". Also I think it's a lot less resource consuming than the selfhosted pre-render alternatives and cheaper than the paid ones.
I'm trying to share some content of my AngularJS website in twitter using next link:
<a href="https://twitter.com/intent/tweet?text=http%3A%2F%2Fwww.test.yanpy.com%2Fes%2Fblog%2Frutas-para-navegar-por-ibiza-y-formentera">
When I click on it, the Twitter share page is opened. However, I would like to use Twitter Cards. I added this twitter cards tags in my page:
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="#Yanpy_com">
<meta name="twitter:title" content="Sailing routes around Ibiza and Formentera">
<meta name="twitter:description" content="Post description">
<meta name="twitter:image" content="http://yanpy.test.s3.amazonaws.com/img/blog/sailing-routes-around-ibiza-formentera/cala-salada-ibiza-1.jpg">
But for some reason it is not working. I used the Twitter card validator with my url: http://www.test.yanpy.com/es/blog/rutas-para-navegar-por-ibiza-y-formentera
It looks like it's ok. However, when called from my anchor in my website I just see the text field.
#AnidMonsur is right don't show a card preview into the twitter web page, but you can see the preview into the validator, https://cards-dev.twitter.com/validator
Try with:
<meta name="twitter:image:src" content="http://..." />
instead of:
<meta name="twitter:image" content="http://...">