Meta SEO 是一個專為 Web 應用程式設計的 Flutter 套件,用於動態管理文件標頭中的 HTML 元標籤。它讓開發者能夠透過設定標題、描述、關鍵字和 Open Graph 屬性等元資料來增強搜尋引擎優化(SEO)。此套件可無縫整合至 Flutter Web 項目中,無需手動操作 DOM 即可輕鬆自訂 SEO 元素。它支援所有主要平台,包括 Web、Android、iOS、macOS、Windows 和 Linux,非常適合需要強大 SEO 表現的跨平台 Web 應用。
適用情境
提高搜尋引擎可見性
增強社交媒體分享
優化網頁應用元數據
多頁應用的動態SEO
支援網頁分析追蹤
主要特色
與 Flutter Web 的輕鬆整合
動態元標籤管理
支援 Open Graph 和 Twitter 卡片
跨平台相容性
自動更新標題標籤
適合對象
Flutter web 開發人員
面向搜尋引擎優化的Web應用
動態內容的應用程式
以行銷為導向的網頁應用
全端 Flutter 團隊
使用建議
主要針對Web平台
需要手動處理伺服器端渲染
僅限客戶端元資料管理
不適用於非 Web 目標
依賴於在Flutter的Web建構流程中的正確使用
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Meta Seo
Flutter package for Meta SEO.
Screenshots
About:
Meta SEO is package for adding meta data for html document in head tag
which meta tags or meta data make search engine optimization for web apps.
Then add the config MetaSEO method before the running of the Flutter app into main.dart file:
voidmain() {
// It is required to add the following to run the meta_seo package correctly// before the running of the Flutter appif (kIsWeb) {
MetaSEO().config();
}
runApp(constMyApp());
}
Finally add MetaSEO into your target web pages:
@overrideWidgetbuild(BuildContext context) {
// Add MetaSEO just into Web platform conditionif(kIsWeb) {
// Define MetaSEO objectMetaSEO meta = MetaSEO();
// add meta seo data for web app as you want
meta.author(author: 'Eng Mouaz M AlShahmeh');
meta.description(description: 'Meta SEO Web Example');
meta.keywords(keywords: 'Flutter, Dart, SEO, Meta, Web');
}
returnconstScaffold(
body: Center(child: Text('Meta SEO Web Example')),
);
}
Other example with GoRouter package
First: Add to pubspec.yaml:
dependencies:meta_seo:^3.0.9go_router:^5.2.0# Add the latest version
Second: The same as before and add the config MetaSEO method before the running of the Flutter app into main.dart file:
voidmain() {
// It is required to add the following to run the meta_seo package correctly// before the running of the Flutter appif (kIsWeb) {
MetaSEO().config();
}
runApp(constMyApp());
}
Then follow GoRouter configuration steps and latest add MetaSEO into your GoRouter as you want:
final router = GoRouter(
initialLocation: '/',
routes: <GoRoute>[
GoRoute(
path: '/',
builder: (BuildContext context, GoRouterState state) {
// Add MetaSEO just into Web platform conditionif(kIsWeb) {
// Define MetaSEO objectMetaSEO meta = MetaSEO();
// add meta seo data for web app as you want
meta.ogTitle(ogTitle: 'First Screen');
meta.description(description: 'First Screen');
meta.keywords(keywords: 'Flutter, Dart, SEO, Meta, Web');
}
returnconstFirstScreen();
},
),
GoRoute(
path: '/second_screen',
builder: (BuildContext context, GoRouterState state) {
// Add MetaSEO just into Web platform conditionif(kIsWeb) {
// Define MetaSEO objectMetaSEO meta = MetaSEO();
// add meta seo data for web app as you want
meta.ogTitle(ogTitle: 'Second Screen');
meta.description(description: 'Second Screen');
meta.keywords(keywords: 'Flutter, Dart, SEO, Meta, Web');
}
returnconstSecondScreen();
},
),
],
);
Extended MetaSEO tags
If you want to use Open Graph or Twitter Card meta tags
Note: You must be in live server not as a local host.
Note: The package delete any duplicated meta tags and keep the latest in order.
The same as before and if you want to use any tags does not exist into the main package
methods just add extended tags as the below:
@overrideWidgetbuild(BuildContext context) {
// Add MetaSEO just into Web platform conditionif(kIsWeb) {
// Define MetaSEO objectMetaSEO meta = MetaSEO();
// add meta seo open graph tags as you want
meta.facebookAppID(facebookAppID: 'your_app_id');
meta.ogTitle(ogTitle: 'Example Screen');
meta.ogDescription(ogDescription: 'Example Screen Description');
meta.ogImage(ogImage: 'https://example.com/example.png');
// here you can add any tags does not exist in the package as this
meta.propertyContent(property: 'og:site_name', content: 'example');
// or if you want to add twitter card meta tags just as the following
meta.twitterCard(twitterCard: TwitterCard.summaryLargeImage);
meta.twitterTitle(twitterTitle: 'Example Screen');
meta.twitterDescription(twitterDescription: 'Example Screen Description');
meta.twitterImage(twitterImage: 'https://example.com/example.png');
// here you can add any tags does not exist in the package as this
meta.nameContent(name: 'twitter:site', content: '@mouaz_m_shahmeh');
}
returnconstScaffold(
body: Center(child: Text('Extended Meta SEO Web Example')),
);
}