Giter Club home page Giter Club logo

seohelper's Introduction

SeoHelper

CodeFactor NuGet

This package helps you to add meta-tags, sitemap.xml and robots.txt into your project easily.

Usage

  1. Install the package via Nuget.
Install-Package SeoHelper -Version 2.0.0

or

dotnet add package SeoHelper --version 2.0.0
  1. Add following service registrations to ConfigureServices method in Startup.cs.

Note: You can define your seo options (meta-tags, sitemap.xml and robots.txt) either specifying them in SeoOptions class or appsettings.json (under a section. E.g: SeoOptions or SeoConfigurations).

services.AddSeo(Configuration, sectionName: "SeoOptions");

If you want to specify your options via appsettings.json. You can create a section named whatever you want ("SeoOptions" in above usage) and specify it in the related service configuration method (AddSeo).

"SeoOptions": {
    "MetaTags": [
      { 
        "RelativeUrl": "/demo",
        "Title": "demo title",
        "Charset": "UTF-8",
        "MetaTagDescriptions": {
          "Author": "author",
          "Description": "description",
          "Keywords": "keywords"
        }
      },
      {
        "RelativeUrl": "/",
        "Title": "index title",
        "Charset": "UTF-8",
        "MetaTagDescriptions": {
          "author": "author",
          "description": "description"
        }
      }
    ],
    "Sitemap": {
      "Urls": [
        {
          "Url": "/article/1",
          "LastModificationDate": "12/12/2012"
        },
        {
          "Url": "/article/2",
          "LastModificationDate": "12/12/2012",
          "Priority": 1.0
        }
      ]
    },
    "RobotsTxt": {
      "DisplaySitemapUrl": true,
      "RobotsTxtSections": [
        {
          "UserAgent": "/google",
          "DisallowUrls": ["/account/manage", "/account/login"],
          "AllowUrls": ["/", "/home-page"]
        },
        {
          "UserAgent": "/yandex",
          "DisallowUrls": ["/account/manage", "/account/login"],
          "AllowUrls": ["*"]
        }
      ]
    },
    "OpenGraph": {
      "Twitter": {
        "Site": "@EngincanVeske",
        "Creator": "@EngincanVeske"
      },
      "Pages": [
        {
          "Url": "/",
          "OgTitle": "og-title",
          "OgType": "og-type",
          "OgImage": "og-image.jpg",
          "OgUrl": "og-url.com"
        },
        {
          "Url": "/demo",
          "OgTitle": "og-title2",
          "OgType": "og-typ2e",
          "OgImage": "og-image2.jpg",
          "OgUrl": "og-url2.com"
        }
      ]
    }
  },

You can configure your options like below in appsettings.json. With v2.0.0 now you can configure your open-graph and twitter card tags as well.

  1. Add following custom middleware to your Configure method in Startup.cs:
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
    //...
    app.UseSeoHelper();
    //...
}

If you encounter a problem, you can examine the sample (SeoHelper.Demo) in this repo.


Roadmap

  • Version 1
  • Meta-tags
  • Sitemap.xml
  • Robots.txt
  • Version 2
  • OpenGraph tags (for social media accounts)
  • Bug-fixes

seohelper's People

Contributors

engincanv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

alitolu

seohelper's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.