如何使用react共享图像和帖子到fb

时间:2018-05-22 17:34:33

标签: reactjs share socialshare react-helmet

我正在使用react-snap来显示元标记,并使用import React, {Component} from 'react' import {Helmet} from "react-helmet"; class Footer extends Component { render(){ let { description, parameter,id ,imageURL, badgeImageURL} = this.props if(id ===3||id==9||id==10||id==6){ description='description 1' }else if(id ===5||id==11||id==7||id==2){ description='description 2' }else if(id ===4||id==1||id==8||id==12){ description='description 3' }else{ description='description 4' } return( <div className="row social-media-logos"> <Helmet> <title>Page Title</title> <meta property="og:url" content={`http://www.sample.com${parameter?parameter:''}`} /> <meta property="og:description" content={description} /> <meta property="og:image" content={imageURL!==''?`${imageURL}`:badgeImageURL} /> <meta property="fb:app_id" content="sample_id" /> </Helmet> <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=www.sample.com"><div className="facebook" ></div></a> <a target="_blank" href={`http://pinterest.com/pin/create/button/?url=http://www.sample.com${parameter?parameter:''}&media=${imageURL}&description=${description}`}><div className="pinterest"></div></a> <a target="_blank" href={`https://twitter.com/intent/tweet?text=${description}&url=http://www.sample.com${parameter?parameter:''}`}><div className="twitter"></div></a> </div> ) } } export default Footer 来预呈现html网页。当我在松弛时共享它时,我能够使用图像描述和标题呈现正确的显示,但如果我在Facebook上分享它,页面不会呈现除标题和网址之外的任何内容。

public class CinemasModel implements Parcelable {

    @SerializedName("ll")
    private ArrayList<Double> mLl;

    @SerializedName("films")
    private List<FilmsModel> mFilms;

    protected CinemasModel(Parcel in) {
        this.mLl = new ArrayList<Double>();
        in.readList(this.mLl, Double.class.getClassLoader());
        this.mFilms = new ArrayList<FilmsModel>();
        in.readList(this.mFilms, FilmsModel.class.getClassLoader());
    }

    public static final Parcelable.Creator<CinemasModel> CREATOR = new Parcelable.Creator<CinemasModel>() {
        @Override
        public CinemasModel createFromParcel(Parcel source) {
            return new CinemasModel(source);
        }

        @Override
        public CinemasModel[] newArray(int size) {
            return new CinemasModel[size];
        }
    };
}

与twitter有同样的问题。有任何想法吗?该站点作为s3存储桶托管在aws上。

0 个答案:

没有答案