def populate_og_data(self, user): """Prepare the OgData object for the context.""" title = user.username if not user.profile.name else user.profile.name image_field = None # For image use reel thumbnail if user.profile.reel_thumbnail_16_9: image_field = user.profile.reel_thumbnail_16_9 # Otherwise use the avatar elif user.profile.avatar: image_field = user.profile.avatar # Otherwise use the thumbnails of the latest posts elif user.post_set.filter(status='published'): latest_post = user.post_set.filter(status='published').last() if latest_post.thumbnail: image_field = latest_post.thumbnail image_alt = f"{title} on anima.to" return OgData( title=title, description=user.profile.bio, image_field=image_field, image_alt=image_alt, )
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['og_data'] = OgData( title="Animation Jobs on anima.to", description="Public jobs board for the world of animation", image_field=None, image_alt=None, ) return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['og_data'] = OgData( title="Animation Events on anima.to", description="Public events in the world of animation.", image_field=None, image_alt=None, ) return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['og_data'] = OgData( title="Rigs on anima.to", description="Curated collection of rigs.", image_field=None, image_alt=None, ) return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['og_data'] = OgData( title='anima.to', description='Connecting animators frame by frame.', image_field=None, image_alt=None, ) return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) title = f"{self.object.title} at {self.object.company}" context['og_data'] = OgData( title=title, description=self.object.description, image_field=None, image_alt=f"{title} on anima.to", ) return context
def populate_og_data(self): """Prepare the OgData object for the context.""" event = self.object image_field = None if not event.image else event.image return OgData( title=event.name, description=event.description, image_field=image_field, image_alt=f"{event.name} on anima.to", )
def default_og_data(_): """Default values for the Open Graph data. This is used as fallback for populating the og: and twitter: tags in every page. """ return { 'og_data_default': OgData( title='anima.to', description='Connecting animators frame by frame.', image_field=None, image_alt='anima.to', ) }
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['og_data'] = OgData( title="Animation Reels on anima.to", description="Collection of reels from the world of animation.", image_field=None, image_alt=None, ) sort = self.request.GET.get('sort') # Build 'sort' query argument to use in the _pagination.pug component # This allows to perform correct pagination if sort == 'recent': context['sort'] = 'sort=recent' return context
def default_og_data(_): """Default values for the Open Graph data. This is used as fallback for populating the og: and twitter: tags in every page. """ return { 'og_data_default': OgData( title=settings.SITE_TITLE, description=settings.SITE_DESCRIPTION, image_field=None, image_alt=settings.SITE_TITLE, ) }
def populate_og_data(self, post): """Prepare the OgData object for the context.""" title = post.user.username if not post.user.profile.name else post.user.profile.name image_field = None if post.thumbnail: image_field = post.thumbnail # Otherwise use the avatar elif post.user.profile.avatar: image_field = post.user.profile.avatar return OgData( title=title, description=post.title, image_field=image_field, image_alt=f"{title} on anima.to", )
def populate_og_data(self): """Prepare the OgData object for the context.""" rig: PostRig = self.object image_field = None # Try to use the rig image (it's a poster image, so it will be cropped) if rig.image: image_field = rig.image image_alt = f"{rig.name} on anima.to" return OgData( title=rig.name, description=rig.description, image_field=image_field, image_alt=image_alt, )
def populate_og_data(self): """Prepare the OgData object for the context.""" user = self.object title = user.username if not user.profile.name else user.profile.name image_field = None # Try to use the reel_thumbnail if user.profile.reel_thumbnail_16_9: image_field = user.profile.reel_thumbnail_16_9 # Otherwise use the avatar elif user.profile.avatar: image_field = user.profile.avatar image_alt = f"{title} on anima.to" return OgData( title=title, description=user.profile.bio, image_field=image_field, image_alt=image_alt, )