tidying to remove path config, just hard-coding it

This commit is contained in:
Adam Piontek 2021-04-01 18:31:30 -04:00
parent df2cc13167
commit ae9fff231b
3 changed files with 3 additions and 13 deletions

View file

@ -66,6 +66,3 @@ config :phoenix, :stacktrace_depth, 20
# Initialize plugs at runtime for faster development compilation # Initialize plugs at runtime for faster development compilation
config :phoenix, :plug_init_mode, :runtime config :phoenix, :plug_init_mode, :runtime
# Finally import the config/dev.secret.exs which loads secret config
import_config "dev.secret.exs"

View file

@ -3,13 +3,7 @@ defmodule Home73k.Blog do
Application.ensure_all_started(:earmark) Application.ensure_all_started(:earmark)
@content_path Application.compile_env(:home73k, [:content_repo, :path], "./priv/content") posts_paths = "priv/content/**/*.md" |> Path.wildcard()
posts_paths =
@content_path
|> Path.expand()
|> Path.join("**/*.md")
|> Path.wildcard()
posts = posts =
for post_path <- posts_paths do for post_path <- posts_paths do

View file

@ -75,7 +75,7 @@ defmodule Home73k.Blog.Post do
# restrict corpus to letters & numbers, # restrict corpus to letters & numbers,
# then split to words (space delim), trimming as we go # then split to words (space delim), trimming as we go
# then reject all 0, 1, 2-letter words, and words in @strip_words # then reject short & common words
# reduce to unique words and join back to space-delim string # reduce to unique words and join back to space-delim string
corpus = corpus =
Regex.replace(~r/[^a-z0-9 ]/, corpus, "") Regex.replace(~r/[^a-z0-9 ]/, corpus, "")
@ -146,8 +146,7 @@ defmodule Home73k.Blog.Post do
end end
# """ reject_word? # """ reject_word?
# Determines if a word should be rejected, based on char length < 3, # Returns true to reject short or common words
# or if word is in @strip_words
# Used by parse_title_to_slug and build_corpus # Used by parse_title_to_slug and build_corpus
# """ # """
defp reject_word?(word), do: String.length(word) < 3 || word in @strip_words defp reject_word?(word), do: String.length(word) < 3 || word in @strip_words