Skip to content
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

Need to specify the link in nav-bar #250

Closed
azzamsa opened this issue Jan 2, 2019 · 24 comments
Closed

Need to specify the link in nav-bar #250

azzamsa opened this issue Jan 2, 2019 · 24 comments
Assignees
Labels
need information We are waiting for more information from one of the actors
Milestone

Comments

@azzamsa
Copy link
Contributor

azzamsa commented Jan 2, 2019

Hi

I saw some issue about this. The original code using "hard coded" .html url. Then someone change it to non hard code.

It took me long time to read the issue and searching the web. Till I find this solution

It works after I specify

TAGS_URL = 'tags.html'
CATEGORIES_URL = 'categories.html'
ARCHIVES_URL = 'archives.html'

Why it doesn't work by default, at least for me ? Am I missing something ?

Thank you for this beloved theme :)

@silverhook
Copy link
Member

@azzamsa, glad you like the theme!

We’re currently wrapping things up for the 2.0 release, so there are still some untied ends.

We have also set up a new website for Elegant, where we host the theme’s documentation as well: https://pelican-elegant.github.io/

The feature you are asking about still needs to be documented, and the issue for it is here: https://github.com/Pelican-Elegant/documentation/issues/23

In short, hard-coding was a limitation of Elegant due to the dependency on Tipue Search. The change in #186 was a compromise between Pelcan’s flexibility and Tipue Search’s inflexibility.

Since you’ve done some research on this already, but weren’t involved with writing the change in the first place, you’d be a perfect candidate to write that little piece. If you’re willing to volunteer, of course 😉

@talha131 talha131 added this to the Elegant 2.0 milestone Jan 2, 2019
@talha131
Copy link
Member

talha131 commented Jan 2, 2019

@azzamsa that's strange. You should not have to add these settings. See our code here

https://github.com/Pelican-Elegant/elegant/blob/master/templates/base.html#L70-L72

Notice the defaults function. For example,

 CATEGORIES_URL|default('categories') 

The code should have worked outside the box.

Can you please,

  1. Make sure you have the latest HEAD from elegant repo?
  2. If it is, then please create a repo with your source and we will try to reproduce it at our end.

@talha131 talha131 added the need information We are waiting for more information from one of the actors label Jan 2, 2019
@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 2, 2019

See our code here

@talha131 Sure I read those code carefully. So that I opened the issue here. I am using the latest version of this repo. I read the code carefully, even I modify archives.html, categories.html and other to have ability for hiding page with my custom metadata.

If it is, then please create a repo with your source and we will try to reproduce it at our end.

This is my source

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 2, 2019

glad you like the theme!

@silverhook yes. it's very neat and beautiful :). I migrated from octopress this morning after using it for about 2 year. Very happy today, because I understand what every files are doing. I don't have any ideas why those bunch of octropess exist. Have more control now with pelican :)

We have also set up a new website for Elegant,

This conf and article examples help me a lot in this migration. It easier to see the real world example. Those "real" source really helped A LOT.

Since you’ve done some research on this already, but weren’t involved with writing the change in the first place, you’d be a perfect candidate to write that little piece. If you’re willing to volunteer, of course wink

Sure, I love python, I may take a look at this.

@talha131
Copy link
Member

talha131 commented Jan 2, 2019

@azzamsa Thanks for the quick response. I need the source code of your blog. What you have pointed me towards, is the generated html.

I need the repository which has your markdown files and pelican configuration in order to reproduce the issue at my end.

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 2, 2019

@talha131 Indeed that was the "source".

I put them together with the output in Github, in different branch. One for source files, another for output

@talha131
Copy link
Member

@iranzo if possible can you spare some time for this?

I tested it cursory on my end but failed to reproduce the issue. I will revisit it later, but meanwhile please look into it if it's not a trouble for you.

@iranzo
Copy link
Member

iranzo commented Jan 14, 2019

I would say, based on getpelican/pelican#1111 that 'defaults' are empty, so as we do use them we should use a comparison and use ARCHIVES_URL or 'archives.html' instead on those ocurrences

@talha131
Copy link
Member

I am lost here. I thought default function in the code should have made sure such issue do not occur.

If we change default('categories') to default('categories.html') for eg, would it fix the issue?

@iranzo
Copy link
Member

iranzo commented Jan 14, 2019

AFAIK, it should, if @azzamsa confirms, I'll use the source files he indicates without the variables he indicated in this post to test

@iranzo iranzo self-assigned this Jan 14, 2019
@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 14, 2019

  1. If I disable the variables setting and add '.html' to base.html : worked
modified   pelicanconf.py
@@ -6,9 +6,9 @@ AUTHOR = 'azzamsa' 
-TAGS_URL = 'tags.html'
-CATEGORIES_URL = 'categories.html'
-ARCHIVES_URL = 'archives.html'
+# TAGS_URL = 'tags.html'
+# CATEGORIES_URL = 'categories.html'
+# ARCHIVES_URL = 'archives.html'
 
modified   templates/base.html
@@ -73,9 +73,9 @@
-                            <li {% if page_name == 'archives' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ ARCHIVES_URL|default('archives') }}">Archives</a></li>
-                            <li {% if page_name == 'categories' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ CATEGORIES_URL|default('categories') }}">Categories</a></li>
-                            <li {% if page_name == 'tags' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ TAGS_URL|default('tags') }}">Tags</a></li>
+                            <li {% if page_name == 'archives' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ ARCHIVES_URL|default('archives.html') }}">Archives</a></li>
+                            <li {% if page_name == 'categories' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ CATEGORIES_URL|default('categories.html') }}">Categories</a></li>
+                            <li {% if page_name == 'tags' %} class="active"{% endif %}><a href="{{ SITEURL }}/{{ TAGS_URL|default('tags.html') }}">Tags</a></li>

HTTP request indicates that the file found

127.0.0.1 - - [14/Jan/2019 20:00:15] "GET /archives.html HTTP/1.1" 200 -
127.0.0.1 - - [14/Jan/2019 20:00:17] "GET /categories.html HTTP/1.1" 200 -
127.0.0.1 - - [14/Jan/2019 20:00:18] "GET /categories.html HTTP/1.1" 200 -
127.0.0.1 - - [14/Jan/2019 20:00:19] "GET /tags.html HTTP/1.1" 200 -
  1. If I disable the variables setting and without adding '.html' to base.html : failed
127.0.0.1 - - [14/Jan/2019 20:02:18] "GET /categories HTTP/1.1" 404 -
127.0.0.1 - - [14/Jan/2019 20:02:18] code 404, message File not found
127.0.0.1 - - [14/Jan/2019 20:02:18] "GET /favicon.ico HTTP/1.1" 404 -
127.0.0.1 - - [14/Jan/2019 20:02:25] code 404, message File not found
127.0.0.1 - - [14/Jan/2019 20:02:25] "GET /tags HTTP/1.1" 404 -

2019-01-14-20 08 09

  1. adding .html manually in step 2.

2019-01-14-20 08 24

@iranzo
Copy link
Member

iranzo commented Jan 14, 2019

While testing #270 , I've tried removing the values for:

#TAGS_URL = 'tags.html'
# CATEGORIES_URL = 'categories.html'
# ARCHIVES_URL = 'archives.html'

by commenting them and it worked fine.

Please note that my updated files for 270 were rebased against master, so not sure if there was any other missing commit there

Categories, archives and tags does work and the default is the 'folder' so /categories/ /tags/ or /archives/

@azzamsa can you test the files attached to 270 and revalidate this issue?

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 15, 2019

@azzamsa can you test the files attached to 270 and revalidate this issue?

Dunno what happened. Tried:

  1. make html with master revision

2019-01-15-11 09 50

  1. make html with hide-article branch

2019-01-15-11 12 47

Nothing works. Maybe the error comes from my local machine.

@iranzo
Copy link
Member

iranzo commented Jan 15, 2019

Check too with the tarball on 270

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 15, 2019

Downloaded, tried, no luck.

2019-01-15-14 42 52

No different in code, just some untracked files.

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 16, 2019

Check too with the tarball on 270

When running the 'untouched' pure tarball. It can't work, page not found. I have to uncomment the commented line from you.

@iranzo
Copy link
Member

iranzo commented Jan 16, 2019

That's my diff for your pelicanconf:
diff --git a/pelicanconf.py b/pelicanconf.py
index 5c776d6..4e0d8d3 100755
--- a/pelicanconf.py
+++ b/pelicanconf.py
@@ -6,9 +6,9 @@ AUTHOR = 'azzamsa'
SITENAME = 'AZZAMSA'
SITEURL = 'http://localhost:8000'

-TAGS_URL = 'tags.html'
-CATEGORIES_URL = 'categories.html'
-ARCHIVES_URL = 'archives.html'
+# TAGS_URL = 'tags.html'
+# CATEGORIES_URL = 'categories.html'
+# ARCHIVES_URL = 'archives.html'

And the tarball uploaded again, with 'standard' Elegant pelican theme (without customizations):

rm -Rfv themes plugins
git submodule update
peru sync

azzamsa.github.io-v2.zip

When running make devserver, the generated page has working ccategories, archives and tags, and the url shown in my browser is:

http://localhost:8000/archives
http://localhost:8000/tags
http://localhost:8000/categories/

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 16, 2019

Tried azzamsa.github.io-v2.zip with no changes : failed. then tried with make html:faied

Btw, I never use make deserver. I use make html/make publish then $ python -m http.server

anim

@iranzo
Copy link
Member

iranzo commented Jan 16, 2019

Hi,

 iranzo  /  tmp  azzamsa  ls
azzamsa.github.io  azzamsa.github.io-v2.zip
 iranzo  /  tmp  azzamsa  cd azzamsa.github.io/
 iranzo   test  /  tmp  azzamsa  azzamsa.github.io  ls
content   output          peru.yaml  publishconf.py  requirements.txt  themes
Makefile  pelicanconf.py  plugins    __pycache__     tasks.py
 iranzo   test  /  tmp  azzamsa  azzamsa.github.io  make devserver
pelican -lr /tmp/azzamsa/azzamsa.github.io/content -o /tmp/azzamsa/azzamsa.github.io/output -s /tmp/azzamsa/azzamsa.github.io/pelicanconf.py 

-> Modified: content, theme, settings, [static]theme/images, [static]images. re-generating...
Done: Processed 19 articles, 0 drafts, 0 pages, 0 hidden pages and 0 draft pages in 0.59 seconds.
127.0.0.1 - - [16/Jan/2019 14:55:45] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [16/Jan/2019 14:55:45] "GET /theme/css/style.min.css?8bdcf96a HTTP/1.1" 304 -
127.0.0.1 - - [16/Jan/2019 14:55:46] "GET /archives HTTP/1.1" 200 -
127.0.0.1 - - [16/Jan/2019 14:55:47] "GET /categories/ HTTP/1.1" 200 -
127.0.0.1 - - [16/Jan/2019 14:55:49] "GET /tags HTTP/1.1" 200 -
127.0.0.1 - - [16/Jan/2019 14:55:50] "GET /archives HTTP/1.1" 304 -

Still works for me on a new temporary folder being created for this.

If you've pipsi installed can you try with latest pelican version and use make devserver which uses the pelican builtin server?

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 16, 2019

Strange, make devserver work, but why python -m http.server didn't work.

So, if make devserver worked. If I do make github if this work in my github pages deployment ?

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 16, 2019

As far as I know browser will read index.html if it read a folder, this same behavior of jekyll, when we created pages about. it created about-dir/index.html.

I suspect devserver handle this 'magically'.

@iranzo
Copy link
Member

iranzo commented Jan 16, 2019

I always did make devserver, tested and then make github and it worked, but it's easy for you to give it a try :-)

@azzamsa
Copy link
Contributor Author

azzamsa commented Jan 16, 2019

DONE. Summary:

  • non direct link doesn't work with normal python server e.g python -m http.server. We have to use ARCHIVES_URL = 'archives.html'
  • non direct link worked, when serving site using make serve / make devserve.

Even if non direct link didn't work with python -m http.server github pages will render it just fine.

I think pelican had already handle non direct link magically. If I am not mistaken.

Thank you for all the help, thanks a ton for very very kind and supportive, Elegant team. 🎉

@azzamsa azzamsa closed this as completed Jan 16, 2019
@talha131
Copy link
Member

Thanks a lot @iranzo. Great job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need information We are waiting for more information from one of the actors
Development

No branches or pull requests

4 participants