View Source Postex.Validate (Postex v0.1.9)

For validating at compile time

Summary

Functions

Raises if there are any duplicate slugs

Raises unless the prefix is set for the use Macro, i.e.

Raises unless all urls (prefix + slug) are less than 60 characters (for SEO) as per Neil Patel.

Functions

no_duplicate_slugs(posts)

@spec no_duplicate_slugs([Postex.Post.t()]) :: [Postex.Post.t()]

Raises if there are any duplicate slugs

prefix_defined(prefix)

@spec prefix_defined(binary() | nil) :: :ok

Raises unless the prefix is set for the use Macro, i.e.

use Postex, prefix: "https://www.yoursite.com/posts/"

or is explicitly disabled, i.e.

use Postex, prefix: false

same_data_fields(posts)

@spec same_data_fields([Postex.Post.t()]) :: [Postex.Post.t()]

url_length(posts, prefix)

@spec url_length([Postex.Post.t()], false | binary()) :: [Postex.Post.t()]

Raises unless all urls (prefix + slug) are less than 60 characters (for SEO) as per Neil Patel.

Feature can be disabled by setting prefix to false