-
Notifications
You must be signed in to change notification settings - Fork 294
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Add ABlog support #796
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Blogs with `ABlog` | ||
|
||
The [ABlog extension](https://ablog.readthedocs.io/) allows you to tag pages as **blog posts** and additionally include them in landing pages for your blog. | ||
It also has a number of sidebar templates to show off collections of your posts. | ||
|
||
This theme has styling support for ABlog, and demonstrates some of its functionality here. | ||
|
||
## Example blog | ||
|
||
Click below to go to the blog | ||
|
||
```{button-link} blog/index.html | ||
:color: primary | ||
Go to the blog | ||
``` | ||
|
||
## Example post list | ||
|
||
```{postlist} | ||
:list-style: circle | ||
:category: Manual | ||
:format: "{title}" | ||
:sort: | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
blogpost: true | ||
date: Jan 01, 2022 | ||
author: pydata | ||
location: World | ||
category: Manual | ||
language: English | ||
--- | ||
|
||
# Post title 1 | ||
|
||
Here's some text for post 1! | ||
|
||
## Post 1 section | ||
|
||
Some more text for post 1's section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
blogpost: true | ||
date: Jan 02, 2022 | ||
author: jupyter | ||
location: World | ||
category: Manual | ||
language: English | ||
--- | ||
|
||
# Post title 2 | ||
|
||
Here's some text for post 2! | ||
|
||
## Post 2 section | ||
|
||
Some more text for post 2's section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
blogpost: true | ||
date: Jan 03, 2022 | ||
author: jupyter | ||
location: World | ||
category: Manual | ||
language: English | ||
--- | ||
|
||
# Post title 3 | ||
|
||
Here's some text for post 3! | ||
|
||
## Post 3 section | ||
|
||
Some more text for post 3's section |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/pydata_sphinx_theme/assets/styles/extensions/_ablog.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* ABlog | ||
* ref: https://ablog.readthedocs.io/ | ||
*/ | ||
// HACK: ABlog has no CSS selector, but directly inserts elements into the sidebar | ||
// So we make an assumption here that any *top-level* sidebar items that are ul/h2/h3 | ||
// Are attached to ABlog. This is hacky and we should try to get top-level ablog | ||
// CSS wrappers into ABlog instead. | ||
.bd-sidebar-primary .sidebar-start-items { | ||
> h3, | ||
> h2 { | ||
margin-top: 1rem; | ||
} | ||
|
||
> ul { | ||
list-style: none; | ||
padding-left: 0; | ||
} | ||
} | ||
|
||
// HACK: ABlog articles always seem to have the structure: | ||
// <section id="POST-TITLE-ID">{{ POST CONTENT }} | ||
// <div class="section"> | ||
// <div class="section" | ||
// <span>previous button | ||
// <span>empty space | ||
// <span>next button | ||
// | ||
// So these rules make that assumption | ||
article.bd-article > section + div.section { | ||
font-size: 1.2em; | ||
|
||
span:first-child:before { | ||
content: "\f104"; | ||
font-family: "Font Awesome 5 Free"; | ||
font-weight: 800; | ||
} | ||
|
||
span:last-child:after { | ||
content: "\f105"; | ||
font-family: "Font Awesome 5 Free"; | ||
font-weight: 800; | ||
} | ||
} | ||
|
||
// The post list on the ablog index | ||
.ablog-post { | ||
ul.ablog-archive { | ||
padding-left: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about overriding the template for the post nav? https://github.com/sunpy/ablog/blob/main/ablog/templates/postnavy.html
That could help avoiding the current hanging arrow at the ends of the post list and include next/previous and the arrow as part of the
<a>
like the rest of the theme.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's actually not that easy to over-ride templates with ABlog until this one is resolved:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I was wondering how the ordering of extension/theme template path worked in relation to dropping a template override in for an individual site.