sunpy / ablog

ABlog for blogging with Sphinx
https://ablog.readthedocs.io/
Other
181 stars 54 forks source link

How to correct the links in my built html pages? #245

Open CalMacCQ opened 1 year ago

CalMacCQ commented 1 year ago

Hi,

This is more of a question rather than a bug report. If preferred I can ask elsewhere instead of raising an issue here.

I'm trying to build and deploy a simple blog using ablog with the pydata sphinx theme. Everything is going well except the links in the built html are broken and I can't seem to fix them.

I have a main blog folder with my conf.py and an index.rst file. I have some blog source files in markdown format (I'm using the myst parser).

The built html looks like this

Screenshot 2023-08-16 at 16 48 27

If I click on the links to the different posts I see this page

Screenshot 2023-08-16 at 16 56 49

It seems each post has its own directory and contains a single index.html file which I did not expect. Clicking on the index.html link does take me to the expected post.

I suspect something has gone with the file structure of my project. I don't think there should be a new directory for every single blog post with a single index.html file in each directory.

Any idea what I've done wrong? I'm sure I'm just missing something.

Any help would be appreciated. Thanks in advance.

nabobalis commented 1 year ago

Do you have a link to your project?

CalMacCQ commented 1 year ago

I've quickly put what I've done so far in a public repo.

https://github.com/CalMacCQ/test-blog

I haven't written any content or deployed anything yet. Just started experimenting with ablog today.

Appreciate you taking a look :)

nabobalis commented 1 year ago

So I can replicate this locally, but I can't figure out why it only affects that project at least locally for me.

I have opened a PR that forces to add the index.html to the blog post url. I am unsure if this will break more items but locally, your project builds with the correct url now.

CalMacCQ commented 1 year ago

Ah, I see.

For this repository I started following the quick start here -> https://ablog.readthedocs.io/en/stable/manual/ablog-quick-start.html. I then modified the file structure.

I seem to be able to replicate this issue with linking to the html pages by creating a fresh project as with ablog start.

I get the same issue as above when I click on first post

Screenshot 2023-08-17 at 14 49 17

I also seem to be getting a lot of warnings when I build the template project.

Screenshot 2023-08-17 at 14 48 45

Screenshot 2023-08-17 at 14 48 34

Is this expected? Are there any issues with the ablog template not working with the newer sphinx versions? (I'm using Version: 7.2.0 but this is just a guess).

Thanks again for looking into this.

nabobalis commented 1 year ago

It should not error like that.

My limited testing seems to have the same problem no matter if I go back to sphinx 4. Still trying to work out what changed that could have caused this.

Sorry for the delay

CalMacCQ commented 1 year ago

Just to clarify my previous comment...

The html pages still build sucessfully. Its just that there's a lot of warnings generated and the linking issue is still there with a fresh quick start project.

CalMacCQ commented 1 year ago

Aha! I was using ablog build to build my html pages.

If I use ablog serve and then check the links locally then they all work fine.

Can you tell I'm not a web developer? :satisfied:

I think I'm unblocked from working on my blog now, hopefully the links should work okay when I deploy the blog. Thanks for taking the time to look into this.

If I have further issues I'll let you know.