set static method
void
set({})
Set robots directive using boolean flags
Implementation
static void set({
bool index = true,
bool follow = true,
bool archive = true,
bool snippet = true,
bool imageIndex = true,
int? maxSnippet,
int? maxImagePreview,
int? maxVideoPreview,
}) {
if (!Webify.isInitialized) return;
final directives = <String>[];
directives.add(index ? 'index' : 'noindex');
directives.add(follow ? 'follow' : 'nofollow');
if (!archive) directives.add('noarchive');
if (!snippet) directives.add('nosnippet');
if (!imageIndex) directives.add('noimageindex');
if (maxSnippet != null) directives.add('max-snippet:$maxSnippet');
if (maxImagePreview != null) {
directives.add('max-image-preview:${_imagePreviewSize(maxImagePreview)}');
}
if (maxVideoPreview != null) {
directives.add('max-video-preview:$maxVideoPreview');
}
setDirective(directives.join(', '));
}