Add instructions on how to view a post

This commit is contained in:
Edward Loveall 2021-10-03 17:17:36 -04:00
parent aacef34a14
commit 2808505b4e
No known key found for this signature in database
GPG key ID: 789A4AE983AC8901
2 changed files with 37 additions and 20 deletions

View file

@ -14,3 +14,13 @@ p.meta {
figure iframe { figure iframe {
max-width: 100%; max-width: 100%;
} }
.highlight {
background: rgba(17, 17, 17, 0.3);
}
@media (prefers-color-scheme: dark) {
.highlight {
background: rgba(221, 221, 221, 0.3);
}
}

View file

@ -4,36 +4,43 @@ class Home::IndexPage < MainLayout
end end
def content def content
post_id = "92f4e0bb9f53"
post_slug = "my-post-#{post_id}"
h1 "Scribe" h1 "Scribe"
h2 "How-To"
article do article do
section do section do
para "To view a medium post, you need the last part of the post's URL." h2 "How-To"
para do
text "To view a Medium post simply replace "
code "medium.com", class: "highlight"
text " with "
code app_domain, class: "highlight"
end
para do para do
text "For example if the URL is: " text "For example if the URL is: "
code "medium.com/@user/#{post_slug}" code do
text " or " span "medium.com", class: "highlight"
code "user.medium.com/#{post_slug}" text "/@user/my-post-09a6af907a2"
text " or " end
code "somewebsite.com/blog/#{post_slug}" text " change it to "
end code do
para do span app_domain, class: "highlight"
text " take " text "/@user/my-post-09a6af907a2"
code post_slug end
text " and add it on to the end of Scribe's post URL: "
end
para do
code Articles::Show.with(post_slug: post_slug).url
end end
end end
section do section do
para do footer do
text "Hint: If you're feeling lazy, the URL only needs to be the nonsense at the end of the post URL. E.g. " para do
code Articles::Show.with(post_slug: post_id).url a "Source code", href: "https://git.sr.ht/~edwardloveall/scribe"
end
end end
end end
end end
end end
def app_domain
URI.parse(Home::Index.url).normalize
.to_s
.sub(/\/$/, "")
.sub(/^https?:\/\//, "")
end
end end