Flutter package for SEO support on Web.

Overview

flutter_seo

pub package

Flutter package for SEO support on Web. The package listens to widget tree changes and converts Seo.text(...), Seo.image(...), Seo.link(...) widgets into html document tree.

See demo here: https://krokyze.github.io/flutter_seo

 

Getting Started

To use this plugin, add seo as a dependency in your pubspec.yaml file.

dependencies:
  seo: ^0.0.1

 
Wrap your app within SeoController which will handle listening to widget tree changes and updating the html document tree. In case your app has authorization and user is logged in you can disable the controller by enabled: false as it's redundant to update the html document tree at that state.

import 'package:seo/seo.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return SeoController(
      enabled: true,
      tree: WidgetTree(context: context),
      child: MaterialApp(...),
    );
  }
}

 
There's two available SeoTree implementations:

  • WidgetTree (recommended) - based on traversing widget tree, while it's bit slower than SemanticsTree it's production ready and doesn't have any blocking Flutter SDK issues.
  • SemanticsTree (experimental) - based on traversing semantic data node tree. Does traverses the tree faster but enables known Flutter SDK issues:

 

Sample Usage

You should wrap all your SEO required widgets accordingly within Seo.text(...), Seo.image(...), Seo.link(...).

Text
Seo.text(
  text: 'Some text',
  child: ...,
); // converts to: <p>Some text</p>
Image
Seo.image(
  src: 'http://www.example.com/image.jpg',
  alt: 'Some example image',
  child: ...,
); // converts to: <img src="http://www.example.com/image.jpg" alt="Some example image"/>
Link
Seo.link(
  href: 'http://www.example.com',
  anchor: 'Some example',
  child: ...,
); // converts to: <a href="http://www.example.com"><p>Some example</p></a>

From personal experience it's more comfortable to create custom AppText, AppImage, AppLink base widgets and use those in the project.

Comments
  • Title of the page

    Title of the page

    It would be nice to be able to set up the <title> of the page, (probably using the same used as the one in the AppBar), wrapping it in a Seo.title() widget.

    But instead of following the same approach that the seo.text() uses, (adding the HTML content in the body), it would be necessary to create the HTML <title> in the header.

    opened by guplem 6
  • Option to prerender html tags during build time

    Option to prerender html tags during build time

    first. thank you for providing this package and working on that. it could be a gamechanger and open a totally new field for flutter web.

    I am not sure if it is possible but it would likely increase indexability and SEO score a lot if it would be possible to prerender the flt-seo tags during build time. maybe with a command like this.

    flutter build web --web-renderer seo-htmlkit

    opened by razfazz 3
  • Facebook og:image meta property

    Facebook og:image meta property

    Hi There, Thanks for the awesome package. I am trying to use the library in a web project of mine which does sharing of images. I tries to use the Seo.head() function to add meta tags to the and I can see the tags in my DOM, but the facebook crawler is unable to find them because it just sees my index.html before rendering. Any idea how this can be solved?

    The way I added the meta tags. Thanks again for your help.

    Seo.head( tags: [ MetaTag(name: 'og:image', content: currentFeed!.imageUrl, ), MetaTag(name: 'title', content: currentFeed!.content, ), MetaTag(name: 'og:title', content: currentFeed!.content, ), MetaTag(name: 'og:description', content: description,), MetaTag(name: 'og:url', content: url,), MetaTag(name: 'og:type', content: 'article',), LinkTag(rel: 'canonical', href: url), ], child: ....

    opened by arindammitra06 2
  • Style of text should affect the HTML tag

    Style of text should affect the HTML tag

    It is probably a good idea to relate a specific HTML tags to specific flutter text styles, so when the HTML gets built, the headline1 uses <h1>, headline2 <h2>, … and for the standard text (body2) <p>. Here you have the list of the styles,

    I do believe that those tags are used by the search engines to categorize the content.

    This package uses a different but similar approach. I wouldn't like to have 2 packages (one for images + links and another for text…)

    opened by guplem 2
  • Usage with other packages

    Usage with other packages

    The SEO package could be integrated very well with inbuilt widgets in flutter. But when it comes to third-party packages such as AnimatedText, it is not the case. There is no way to integrate the SEO package with packages. Are there any upcoming releases or workaround for this one?

    opened by chrisbinsunny 1
  • Would you like to make this a Flutter Bounty Hunters project?

    Would you like to make this a Flutter Bounty Hunters project?

    Hi, I came across this package and it seems like an interesting direction for search indexing of Flutter webpages.

    At the Flutter Bounty Hunters, we've been working on document editors and renderers in Super Editor. We also build our webpages with Flutter for web. This project looks like it would make sense within that ecosystem.

    If you'd like to chat about migrating this project into our portfolio, and then working on getting funding for it, please let me know. You can respond here, or send me a DM on twitter, or message me at https://flutterbountyhunters.com

    opened by matthew-carroll 1
  • fix demo 404

    fix demo 404

    Just because Github doesn't support routing all trough single path, we need to revert back to default hash url strategy so example demo doesn't return 404.

    For real life scenario you can configure for example nginx to route all trough single path and use url strategy.

    opened by krokyze 0
  • Any disadvantages?

    Any disadvantages?

    Hi, thanks for the great package. I don’t have any seo experience. So, I have to ask this question before investing in Flutter for web. Does this package have any disadvatages when compared to other seo packges or when compared to regular js web apps?

    opened by deadsoul44 5
Releases(0.0.2)
Owner
Martin Anderson
Martin Anderson
A font loader to download, cache and load web fonts in flutter with support for Firebase Cloud Storage.

Dynamic Cached Fonts A simple, easy to use yet customizable font loader to use web fonts. Demo: https://sidrao2006.github.io/dynamic_cached_fonts ?? I

Aneesh Rao 18 Dec 21, 2022
An online Dart editor with support for console, web, and Flutter apps

DartPad DartPad is a free, open-source online editor to help developers learn about Dart and Flutter. You can access it at dartpad.dev. What is it? Wh

Dart 1.4k Jan 4, 2023
Flutter boilerplate: support Android, iOS, Web, Mac, Linux, Window with bloc(cubit) state management

Flutter boilerplate: support Android, iOS, Web, Mac, Linux, Window with bloc(cubit) state management, dynamic theme, localization, environment (.env), logger, navigation (go_router), responsiveness (mobile, tablet, desktop), lint, unit/widget/integration test and more ...

Bumbii Co., Ltd 34 Dec 29, 2022
Flutter boilerplate: support Android, iOS, Web, Mac, Linux, Window with bloc(cubit)

Flutter boilerplate: support Android, iOS, Web, Mac, Linux, Window with bloc(cubit) state management, dynamic theme, localization, environment (.env), logger, navigation (go_router), responsiveness (mobile, tablet, desktop), lint, and unit/integration test.

Bumbii Co., Ltd 34 Dec 29, 2022
Drag and Drop for Dart web apps with mouse and touch support.

Dart Drag and Drop Drag and Drop for Dart web apps with mouse and touch support. GitHub | Pub | Demos and Examples Features Use any HTML Element as Dr

Marco Jakob 136 Nov 18, 2022
flutter web app with given code and example. Step by step teaching how to build a flutter web app with backend

flutter_web A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started if t

dbestech 20 Oct 26, 2022
Flutter-web-portfolio - A Basic web portfolio built using flutter

My Flutter Web Portfolio It is a basic flutter web portfolio. 1. Home To use thi

Aleyna Eser 2 May 30, 2022
Flutter web socket - Flutter Web Socket Example

web_socket_example A new Flutter Web Socket project. Getx and web_scoket_channel

Gizem Malçok 7 Nov 2, 2022
Trying out Flutter for desktop Web app development as an alternative to SPA frameworks (such as React and Angular) by recreating one of the pages of an existing CV Management web app

HTML Renderer Demo CanvasKit Renderer Demo Reddit discussion This repo contains a PoC of using Flutter as a traditional SPA framework for creating a d

Maxim Saplin 20 Oct 11, 2022
An isolated worker for Flutter (Isolate) and Web (Web Worker). Behaves almost the same as the compute function, except it is not a one-off worker.

A singleton isolated worker for all platforms. On most platforms, it uses Flutter's Isolate, except on the web, since Isolate is not available, it use

Iandi Santulus 30 Nov 11, 2022
A zero-dependency web framework for writing web apps in plain Dart.

Rad Rad is a frontend framework for creating fast and interactive web apps using Dart. It's inspired from Flutter and shares same programming paradigm

null 70 Dec 13, 2022
A flutter package from AsurRaa for widgets and utility functions to support mobile departments here.

sura_flutter A flutter package from AsurRaa for custom widgets and utility functions. Migrate from 0.2.x to 0.3.x BREAKING CHANGE: remove FutureManage

AsurRaa 4 Nov 15, 2022
💳 A Flutter package for making payments via credo central. Provides support for both Android and iOS

?? Credo Package for Flutter TODO: Put a short description of the package here that helps potential users know whether this package might be useful fo

Samuel Abada 0 Dec 26, 2021
A flutter deskstop package that allows you to drag the native file into app support.

FileDragAndDrop A flutter deskstop package that allows you to drag the native file into app support. Platform Support Now only support on macOS, if an

逸风 13 Oct 24, 2022
A package support for build responsive application on Flutter

fl_responsive_guide Basic Để hiểu được về việc build reponsive chúng ta cần nhìn lại 1 số khái niệm mà Material Design đề cập đến như: Layout anatomy

Đặng Ngọc Đức 2 Jul 17, 2022
Imgix package for Dart. Imgix is a CDN service with support for realtime image processing and optimization.

Imgix package for Dart. Imgix is a CDN service with support for realtime image processing and optimization.

Nikkei Inc. 3 Jan 24, 2022
Dart package to support Wake-on-LAN functionality

wake_on_lan Dart library package to easily send Wake-on-LAN magic packets to devices on your local network. Getting Started wake_on_lan has three core

Jagandeep Brar 3 Oct 24, 2022
Google Cloud Platform support package (gcloud)

Google Cloud Platform support package (gcloud) The gcloud package provides a hig

Behruz Hurramov 0 Dec 28, 2021