1
0
mirror of https://github.com/avinal/avinal.github.io.git synced 2026-07-04 07:40:09 +05:30

add favicon and html page handling

Signed-off-by: Avinal Kumar <avinal.xlvii@gmail.com>
This commit is contained in:
2022-09-16 02:35:40 +05:30
parent 3840e00bec
commit fe325ca25a
18 changed files with 282 additions and 5863 deletions
+90 -26
View File
@@ -56,20 +56,22 @@ view : Model -> Html Msg
view model =
div [ class "foo-interface" ]
[ div [ class "foo-console foo-terminal foo-active" ]
[ div [ class "main-wrapper" ]
[ main_ [ class "main-content", id "content" ]
[ case model.blog of
Just blog ->
case blog.meta.image of
Just image ->
img [ src image ] []
[ div [ class "page-wrapper category-html document-page" ]
[ div [ class "main-wrapper" ]
[ main_ [ class "main-content", id "content" ]
[ case model.blog of
Just blog ->
case blog.meta.image of
Just image ->
img [ src image ] []
Nothing ->
text ""
Nothing ->
text ""
Nothing ->
text ""
, viewArticle model.success
Nothing ->
text ""
, viewArticle model
]
]
]
]
@@ -102,21 +104,21 @@ viewToc show =
div [] []
viewArticle : Bool -> Html Msg
viewArticle show =
viewArticle : Model -> Html Msg
viewArticle model =
article
[ class "main-page-content" ]
[ div [ id "insert-here" ] []
, viewMetadata show
, viewMetadata model
]
viewMetadata : Bool -> Html Msg
viewMetadata show =
viewMetadata : Model -> Html Msg
viewMetadata model =
aside
[ class "metadata"
, style "display"
(if show then
(if model.success then
"block"
else
@@ -128,12 +130,23 @@ viewMetadata show =
[ h3 [] [ text "Found a problem" ]
, ul []
[ li []
[ a [ href "https://github.com/avinal" ]
[ text "open an issue" ]
[ a
[ href
("https://github.com/avinal/avinal.github.io/issues/new?title=blog:"
++ (case model.blog of
Just blog ->
blog.meta.title
Nothing ->
model.markdownUrl
)
)
]
[ text "Open an issue on ", i [ class "fa-brands fa-github" ] [] ]
]
, li []
[ a [ href "https://avinal.space" ]
[ text "Website" ]
[ a [ href "mailto:ripple+blog@avinal.space" ]
[ text "Contact me via email" ]
]
]
]
@@ -147,24 +160,70 @@ type Msg
| NoSuchPage
{-| To maintain compatibility with old links
Old links: <https://avinal.space/posts/category/slug.html>
New links: <https://avinal.space/posts/category/slug>
-}
removeHtmlSuffix : String -> String
removeHtmlSuffix slug =
if String.right 5 slug == ".html" then
String.dropRight 5 slug
else
slug
init : List String -> ( Model, Cmd Msg )
init pathList =
case pathList of
[ category, slug, fragment ] ->
let
requestUrl =
Base.contentUrlPrefix
++ "posts/"
++ category
++ "/"
++ removeHtmlSuffix slug
++ ".md"
in
( { initialModel
| markdownUrl = Base.contentUrlPrefix ++ "posts/" ++ category ++ "/" ++ slug ++ ".md"
| markdownUrl = requestUrl
, fragment = fragment
}
, getMarkdown (Base.contentUrlPrefix ++ "posts/" ++ category ++ "/" ++ slug ++ ".md")
, getMarkdown requestUrl
)
[ category, slug ] ->
let
requestUrl =
Base.contentUrlPrefix
++ "posts/"
++ category
++ "/"
++ removeHtmlSuffix slug
++ ".md"
in
( { initialModel
| markdownUrl = Base.contentUrlPrefix ++ "posts/" ++ category ++ "/" ++ slug ++ ".md"
| markdownUrl = requestUrl
}
, getMarkdown (Base.contentUrlPrefix ++ "posts/" ++ category ++ "/" ++ slug ++ ".md")
, getMarkdown requestUrl
)
-- [ category ] ->
-- let
-- requestUrl =
-- Base.contentUrlPrefix
-- ++ "posts/"
-- ++ category
-- ++ ".md"
-- in
-- ( { initialModel
-- | markdownUrl = requestUrl
-- }
-- , getMarkdown requestUrl
-- )
-- [ "categories" ] ->
-- ( { blog = Nothing
-- , markdownUrl = urlPrefix ++ "/categories" ++ ".md"
@@ -182,6 +241,11 @@ init pathList =
_ ->
( initialModel, Cmd.none )
-- badPageError: String -> Cmd Msg
-- badPageError url =
getMarkdown : String -> Cmd Msg
getMarkdown url =
+8 -6
View File
@@ -1,6 +1,6 @@
module Splash exposing (..)
import Html exposing (Html, a, div, i, img, span, text)
import Html exposing (Html, a, b, div, i, img, span, text)
import Html.Attributes exposing (alt, class, height, href, src, width)
@@ -25,10 +25,10 @@ view model =
, div [ class "foo-support__message" ] [ model.support_message ]
, div [ class "foo-error__message" ] [ model.error_message ]
, withSpacing (div [ class "foo-support__message" ])
[ a [ href "https://avinal.space/pages/about-me" ] [ text "About me" ]
, a [ href "https://avinal.space/posts" ] [ text "Blog" ]
, a [ href "https://avinal.space/pages/projects" ] [ text "Projects" ]
, a [ href "https://gsoc.avinal.space" ] [ text "GSoC" ]
[ a [ href "https://avinal.space/pages/about-me" ] [ b [ class "foo-term-blue" ] [ text "A" ], text "bout" ]
, a [ href "https://avinal.space/posts" ] [ b [ class "foo-term-blue" ] [ text "B" ], text "log" ]
, a [ href "https://avinal.space/pages/projects" ] [ b [ class "foo-term-blue" ] [ text "P" ], text "rojects" ]
, a [ href "https://gsoc.avinal.space" ] [ b [ class "foo-term-blue" ] [ text "G" ], text "SoC" ]
]
]
]
@@ -76,7 +76,9 @@ default =
]
, error_message =
withSpacing (span [])
[ text "I'm Avinal, and I work at Red Hat"
[ text "I'm"
, b [ class "foo-term-pink" ] [ text "Avinal" ]
, text "and I work at Red Hat"
, i [ class "fa-brands fa-redhat foo-term-red" ] []
, text "as an Associate Software Engineer for Hybrid Cloud Engineering."
]