-
-
Save meriouma/a97a452da19ff46024ac to your computer and use it in GitHub Desktop.
SEO - Dynamic Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.arcbees.seo.Image; | |
import com.arcbees.seo.OpenGraph; | |
import com.arcbees.seo.SeoElements; | |
import com.arcbees.seo.TagsInjector; | |
// Other imports... | |
public class MyViewImpl implements MyView, AttachEvent.Handler { | |
interface Binder extends UiBinder<Widget, MyViewImpl> {} | |
private final Widget widget; | |
private final TagsInjector tagsInjector; | |
@Inject | |
MyViewImpl( | |
Binder binder. | |
TagsInjector tagsInjector) { | |
widget = binder.createAndBindUi(this); | |
this.tagsInjector = tagsInjector; | |
} | |
@Override | |
public void setProduct(Product product) { | |
Photo photo = product.getPhoto(); | |
Image image = new Image(photo.getUrl(), photo.getHeight(), photo.getWidth(), photo.getMimeType()); | |
OpenGraph openGraph = new OpenGraph.Builder() | |
.withImage(image) | |
.build(); | |
SeoElements seoElements = new SeoElements.Builder() | |
.withTitle(product.getName()) | |
.withDescription(product.getDescription()) | |
.withOpenGraph(openGraph) | |
.build(); | |
tagsInjector.inject(seoElements); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment