패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.0.10

seo

웹에서 SEO(메타, body 태그) 지원을 활성화하기 위한 플러터 패키지입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
1.2만
좋아요
142
Pub 점수
140

패키지 설치

flutter pub add seo

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

seo 패키지는 웹 애플리케이션의 SEO 기능을 향상시키기 위해 설계된 Flutter 플러그인으로, 메타 태그와 본문 속성을 동적으로 관리할 수 있도록 합니다. 개발자는 Dart 코드에서 제목, 설명, Open Graph 태그 및 기타 SEO 관련 콘텐츠를 직접 설정할 수 있습니다. 이를 통해 검색 엔진이 웹 페이지를 올바르게 인덱싱할 수 있어 가시성과 순위가 향상됩니다. 이 패키지는 Flutter의 웹 플랫폼과 원활하게 통합되며 서버 사이드 렌더링 고려사항도 지원합니다. 수동으로 HTML을 조작하지 않고도 풍부한 메타데이터 제어가 필요한 앱에 특히 유용합니다.

사용 사례

  • 동적 메타 태그 업데이트
  • 개선된 검색 엔진 인덱싱
  • 소셜 미디어 공유 최적화
  • 단페이지 애플리케이션 SEO
  • 경로 기반 콘텐츠 개인화
  • 서버 사이드 렌더링 호환성

주요 기능

  • 메타 태그 관리를 쉽게
  • Open Graph 및 Twitter 카드 지원
  • 동적 제목 및 설명 변경
  • 크로스 플랫폼 웹 지원
  • 최소한의 보일러플레이트
  • Flutter 라우팅과의 통합

적합한 대상

  • 웹 전용 플러터 앱
  • SEO 중심 웹 애플리케이션
  • 동적 콘텐츠를 가진 앱
  • 검색 가시성을 우선시하는 개발자
  • 소셜 미디어 메타데이터가 필요한 프로젝트
  • 클라이언트 측 라우팅을 사용하는 앱

고려 사항

  • 모바일 플랫폼(안드로이드/아이오스)에 적용되지 않음
  • 다중 경로 시나리오에서는 주의 깊은 조작이 필요합니다
  • 웹 플랫폼 기능에 제한됨
  • 완전한 SSR 프레임워크를 대체하지 않습니다
  • 고급 SEO를 위해 수동 구성이 필요합니다
  • 적절한 페이지 구조와 함께 사용하는 것이 가장 좋습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

flutter_seo

pub package

Flutter package for enabling SEO (meta, body tag) support on Web. The package listens to widget tree changes and converts Seo.text(...), Seo.image(...), Seo.link(...), Seo.head(...) widgets into html document tree. View Demo

 

Getting Started

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

dependencies:
  seo: ^0.0.10

Use usePathUrlStrategy() to ensure that Google recognizes each URL as a distinct page. Failure to do so may result in Google perceiving all URLs as the same page. For additional details, refer to this video.

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

 
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() {
  usePathUrlStrategy();
  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 traverse the tree faster but doesn't support Seo.head(...), Seo.text(style: ...), Seo.link(rel: ...), Seo.html(html: ...)

 

Sample Usage

You should wrap all your SEO required widgets accordingly within Seo.text(...), Seo.image(...), Seo.link(...) and SEO required pages within Seo.head(...). From personal experience it's more comfortable to create custom AppText, AppImage, AppLink, AppHead base widgets and use those in the project.

Text
Seo.text(
  text: 'Some text',
  child: ...,
); // converts to: <p>Some text</p>

Seo.text(
  text: 'Some text',
  style: TextTagStyle.h1,
  child: ...,
); // converts to: <h1>Some text</h1>
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',
  rel: 'nofollow', (optional)
  child: ...,
); // converts to: <a href="http://www.example.com" rel="nofollow"><p>Some example</p></a>
Html
Seo.html(
  html: '<div>Some raw html</div>',
  child: ...,
); // converts to: <div>Some raw html</div>
Head
Seo.head(
  tags: [
    MetaTag(name: 'title', content: 'Flutter SEO Example'),
    LinkTag(rel: 'canonical', href: 'http://www.example.com'),
  ],
  child: ...,
); // converts to: <meta name="title" content="Flutter SEO Example"><link rel="canonical" href="http://www.example.com" />

Warning: Open Graph (og:title, og:description, etc.) and Twitter Card (twitter:title, twitter:description, etc.) will not work. Read more.

 

Tips

Supporting Open Graph, Twitter Card tags

Facebook, Twitter, etc. simply load index.html and don't execute any JavaScript that webpage contains so we're not able to change meta tags within Dart code. The proposed solution is to create simple Server-Side Rendering which would add Open Graph, Twitter Card tags within index.html before returning it to Client.

 

Demo

View demo here: https://flutter-seo.netlify.app

PageSpeed Insights

MobilePerformance ≈56Accessibility 87Best Practices 100SEO 100
DesktopPerformance ≈85Accessibility 88Best Practices 100SEO 100

Google Search

Landing page has been indexed and does appear in Search

Remaining pages have Discovered - currently not indexed status. I am investigating why.

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.