GithubHelp home page GithubHelp logo

danielpalme / mvcblog Goto Github PK

View Code? Open in Web Editor NEW
236.0 50.0 144.0 10.87 MB

Blog engine based on ASP.NET Core 8 and Twitter Bootstrap 4

License: Apache License 2.0

C# 12.44% CSS 5.99% JavaScript 68.16% HTML 3.52% Batchfile 0.02% SCSS 9.87%
blog-engine

mvcblog's Introduction

MVCBlog

Blog engine based on ASP.NET MVC Core 8 and Twitter Bootstrap 4

See this blog post for details:
www.palmmedia.de/Blog/2013/9/6/aspnet-mvc-4-blog-engine-based-on-twitter-bootstrap

Author: Daniel Palme
Blog: www.palmmedia.de
Twitter: @danielpalme

Getting started

  1. Open appsettings.json and adjust the settings to your needs.
  2. Start the project MVCBlog.Web
  3. Register a new user account
  4. Disable newUsersCanRegister in appsettings.json to prevent that everyone can register a new account
  5. Start blogging

mvcblog's People

Contributors

danielpalme 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mvcblog's Issues

TagRecords from Tags table not being removed when delete blogEntry

When deleting a BlogEntry the EF will cascade delete the TagBlogEntries table but the Tags table isn't affected resulting in a lot of tag-orphans.
This means that the Tags section (sidebar) is stil displaying the deleted Tags (effective after an hour or application restart).

I've fixed it by adding Tag deletion code in the HandleAsync of the DeleteBlogEntryCommandHandler but maybe I'm overlooking something.....

By the way, why the 3600 cacheduration on the sidebar?
Great project!

spam protection not generating

I have implemented your spam protection to my asp.net core 3.1 project but it's not building the <input type="hidden" name="SpamProtectionTimeStamp" value="1592192250" /> as it does on your site.

I'm not sure how to provide a bug as nothing shows up on my contact for but I am mirroring what's going on in your MVCBlog.

Do you know of something else I could try and look at? perhaps I'm missing something?

I'm using both Spam files in a /Helpers directory in a single project so my _ViewImports.cshtml file looks like this: @addTagHelper MySite.Helpers.SpamProtectionTagHelper, MySite

SingleOrDefault instead of FirstOrDefault in AddOrUpdateBlogEntryCommandHandler

foreach (var tag in tags.Where(t => !entry.Tags.Select(et => et.Tag.Name).Contains(t)).ToArray())
{
    var existingTag = existingTags.SingleOrDefault(t => t.Name.Equals(tag, StringComparison.OrdinalIgnoreCase));

    if (existingTag == null)
    {
        existingTag = new Tag() { Name = tag };
        existingTags.Add(existingTag);

        this.unitOfWork.Tags.Add(existingTag);
    }

    entry.Tags.Add(new BlogEntryTag()
    {
        BlogEntryId = entry.Id,
        TagId = existingTag.Id
    });
}

AddOrUpdateBlogEntryCommandHandler.cs line: 84

var existingTag = existingTags.SingleOrDefault(t => t.Name.Equals(tag, StringComparison.OrdinalIgnoreCase));

In this line SingleOrDefault will throw an exception if existingTag is null. So, it seems there is no meaning of cheking existingTag if null or not.

    if (existingTag == null)
    {
        existingTag = new Tag() { Name = tag };
        existingTags.Add(existingTag);

        this.unitOfWork.Tags.Add(existingTag);
    }

I'm just asking to learn and understand. Why didn't you use FirstOfDefault instead of SingleOrDefault? Thank you.

Sitemap creation in blog

Do you have any plans to work on sitemap creation in the blog to make it more search engine friendly?

Why fetching all tags?

        private async Task AddTagsAsync(BlogEntry entry, IEnumerable<string> tags)
        {
            var existingTags = await this.unitOfWork.Tags.ToListAsync();

            if (entry.Tags == null)
            {
                entry.Tags = new Collection<BlogEntryTag>();
            }

            foreach (var tag in entry.Tags.Where(t => !tags.Contains(t.Tag.Name)).ToArray())
            {
                entry.Tags.Remove(tag);
            }

            foreach (var tag in tags.Where(t => !entry.Tags.Select(et => et.Tag.Name).Contains(t)).ToArray())
            {
                var existingTag = existingTags.SingleOrDefault(t => t.Name.Equals(tag, StringComparison.OrdinalIgnoreCase));

                if (existingTag == null)
                {
                    existingTag = new Tag() { Name = tag };
                    existingTags.Add(existingTag);

                    this.unitOfWork.Tags.Add(existingTag);
                }

                entry.Tags.Add(new BlogEntryTag()
                {
                    BlogEntryId = entry.Id,
                    TagId = existingTag.Id
                });
            }
        }

Why do you fetching all tags here?

var existingTags = await this.unitOfWork.Tags.ToListAsync();

Hello, I use to MVC 4 And this error.

Server Error in '/' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'MVCBlog.Website'.

Source Error:

Line 1: <%@ Application Codebehind="Global.asax.cs" Inherits="MVCBlog.Website.MvcApplication" Language="C#" %>

Source File: /global.asax Line: 1

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237

how can i fix ?

334 Errors

Hi,

When I download the zip file and try to run the solution, I get 334 errors (i.e. "The type or namespace name 'Elmah' could not be found (are you missing a using directive or an assembly reference?).

I'm using VS 2015 community and Windows 10 with anniversary update.

T4MVC problem

Hello, I'm having problems with T4MVC. If I Debug T4 template or Run custom tool, I get these errors that won't go away:

Error 41 A namespace cannot directly contain members such as fields or methods C:\Users\edr\Downloads\MVCBlog-master2\MVCBlog-master\src\MVCBlog.Website\T4MVC.cs 1 1 MVCBlog.Website

Error 42 Compiling transformation: Invalid token 'this' in class, struct, or interface member declaration c:\Users\edr\Downloads\MVCBlog-master2\MVCBlog-master\src\MVCBlog.Website\T4MVC.tt 1 1 MVCBlog.Website

Error 43 Compiling transformation: Method must have a return type c:\Users\edr\Downloads\MVCBlog-master2\MVCBlog-master\src\MVCBlog.Website\T4MVC.tt 1 6 MVCBlog.Website

Error 44 Compiling transformation: Type expected c:\Users\edr\Downloads\MVCBlog-master2\MVCBlog-master\src\MVCBlog.Website\T4MVC.tt 1 12 MVCBlog.Website

Do you know anything about this?

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.