Learning by Trial And Error

Learning by Trial And Error

Every day or two I see people post about how the Fediverse should be simplified to welcome new people. It’s a shame. Signing up for a fediverse server is easy. It’s the same process as for every site. The biggest difference is that you’re signing up for a privately owned, crowd sourced community instance. The instances vary slightly from mastodon to firefish to ClassicPress to WordPress but at their core they are the same. It’s just the community that changes, but even that can be the same if you migrate from one instance to another.

Experimenting

A core aspect of the World Wide Web is that it is a platform where people can experiment with ideas, community tools and more. If you need a manual then you are stuck on websites like Twitter and Facebook, rather than exploring what the World Wide Web has to offer. You’re stuck in a silo.

It worries me that people want to simplify the Fediverse, to write guide books and tutorials. If you spend an hour or two experimenting you’ll understand how things work with ease. I don’t think we need manuals for everything in life, especially not social networks on the fediverse.

The Case for Manuals and Tutorials

There are moments when manuals and tutorials are important. That’s when you’re trying to use something that is not as intuitive as you had hoped. WordPress is plug and play and requires no manual. It works like every other CMS works, so it’s easy to pick up. Hugo is easy to pick up, but you might need to RTFM for one or two functionalities.

The moment you really need a manual or instructions is when you’re experimenting with Angular, Laravel, 11ty, Jekyll and other platforms. It’s when you don’t know what the options are that you need a manual. With the Fediverse all the answers are easy to find. You just need to spend a few minutes looking for them. I suspect that chatGPT, Bard and Bing AI can help you when you have questions.

With Hugo I was able to create pages and get a table of contents with relative ease. With 11ty I got a little stuck so I felt the need for a tutorial. I know what I want to do, and I know how I expect it to work, but it’s not like other solutions. that’s why I decided that for 11ty I would use a learning resource, or more, to experiment with, and learn how to use the tool. I am not against manuals and instructions. I like to read the fantastic manuals, when I get stuck. I even like to ask AI for help in some cases, because I can ask a tailored question and get a tailored answer.

The Case Against Manuals

The more time I spend on Mastodon and the Fediverse, the more it feels like a waste of time. I love the concept, and the freedom we have on the website. What I don’t like is that people want to write manuals and instructions to make the same mistakes as people made, on mastodon, and if that is the case, then I have no reason to stick around. Every day people discuss how to use hashtags, bully people into writing alt text for imagess and encourage thousands or tens of thousands of people to follow individual accounts. If that is what people want then there is little reason for using Mastodon, rather than Twitter. Twitter has the community of friends amassed from 2006 to 2023. The Fediverse is a network of strangers.

I Want the Community to Teach Itself

I want communities to learn by participating, rather than reading. I don’t want people to read a manual about how to use the fediverse, I want them to learn by trial and error, and by what feels good, rather than by doing what is expected. The more time I spend on the fediverse, seeing people speak about better onboarding, the more it feels kitsch, and the more I want to close the tabs.

Experimenting with Eleventy

Since I was getting stuck with eleventy I decided to follow Learn Eleventy From Scratch. As I said, it’s not that I am opposed to learning from guides, manuals, or documentation. I like to learn from these sources, when trial and error doesn’t yield the results that I am looking for, or where trial and error takes more time than is reasonable to figure out.

What I want to do is simple. I want to have one directory for posts, and so far that works quite easily, but I also want another folder that acts as an archive. That is where I am getting stuck, and that is where a manual can streamline my learning process. It’s when I see that I have gaps in understanding that I use manuals to fill them.

And Finally

In my experience the people who write manuals on how to use social media websites are utilitarian, rather than humanists. They encourage people to develop a utilitarian approach to social media and that’s what I fear, and object to.

When you look for books about blogging none of them are about the philosophical or intellectual process. They are all about monetisation, which is fantastic, if you want to be a spammer, but awful if you want to be a humanist. I blog to explore ideas, concepts, and speak of cycling, walking and climbing experiences. If I followed the guide books my blog would be aimed at making a fortune, rather than developing and elaborating ideas.

I will always try something new, without RTFMing (Reading the fantastic Manual), before getting stuck and following a tutorial. What has changed is that now I am learning through manuals, instructions and more, rather than online tutorials. I am learning independently. I am a step further along now.

Hugo and Upload Time

Hugo and Upload Time

I like blogging with Hugo. I like writing my daily article in VIM and then exporting it to WordPress, before publishing it both with Hugo and WordPress. The build time for this build was 14 seconds but it can take up to 20 seconds. Although this i slow this isn’t the bottle neck.

New Files and Hugo

Every time you create a blog post, and every time you use a keyword that’s tag page has to be regenerated. If you use two, three or more tags then three or four pages need to be updated. As well as these pages needing to be regenerated so does the site’s index page, and others. If you include related pages at the bottom of the page, then every article with the tag also needs to be updated. The result is that tens, or even hundreds of pages need to updated at a time.

FTP Compare

Every day I write a blog post and every day I use Hugo to rebuild the website. All the files that have been updated need to be uploaded to the server. I don’t want to overwrite every page, when it makes more sense just to overwrite the updated pages. This usually takes time. I experimented with Filezilla and Cyberduck. Both take at least an hour or two every single day, to work through and upload the new pages. This is time consuming and inefficient. With WordPress, Drupal and other solutions, you write the post, publish and you’re done. The same is true of Hugo with smaller websites.

When a website has thousands of articles and tags Hugo becomes slow, at the upload stage. It’s at this point that the switch to a faster solution makes sense.

And Finally

I will continue to experiment with Hugo and my blog but I will not publish on a regular basis, since uploading takes time. I will upload once a week to save time and resources. I have come up with a workflow and it works. I have learned at least the basics of Hugo and now I can move on to carry out more experimentation.

ClassicPress and the Fediverse – Not Quite Ready
|

ClassicPress and the Fediverse – Not Quite Ready

Yesterday I experimented with migrating my blog from WordPress to ClassicPress to see whether ClassicPress plays nicely with the fediverse. It does but there is room for improvement.

If you want instructions on how to migrate from wordpress you can find the instructions here. Summarised, you download the switch to ClassicPress plugin, you run it, it checks that you’re ready to migrate, you fix what needs to be fixed, and when ClassicPress sees that you’re ready it will allow you to start the migration. The migration takes a second or two. It felt almost instant in my case. You know it has succeeded because you see the “ClassicPress” message at the bottom of the admin section.

Wanting to Quit WordPress

I want to dump WordPress for two main reasons. The first is that it has become bloated and slow. It offers an enormous amount of functionality, but at the cost of speed, and efficiency. The second reason is that it uses React and I am deeply opposed to anything developed by Facebook. Instead of connecting single people, it reminds single people of their isolation. It gets caught playing with emotions, and facilitating genocide, and never, ever apologises. By using React WordPress is closer to Facebook than I would like.

How Well ClassicPress plays with the Fediverse

If you want to write a blog post, and for it to show up on the fediverse via the Activity Plugin then it’s ready and work well. As soon as you post from ClassicPress it shows up in the fediverse streams. If that’s what you want to do then it works seamlessly.

Comments Unseen

With WordPress if someone comments to a post on the fediverse then it shows up in the wordpress comments section. With ClassicPress the comments are only visible on the fediverse. The quick fix to this, is to write a comment in wordpress that shows up on the fediverse. At this point communication is two way.

Why This Matters

If you’re writing blog posts, and people comment on the fediverse, but you can’t see the comments, then you won’t know to thank, ignore or react. You will be posting into a vacuum with no dialogue taking place. By having two way commenting we have a way of having the blog as an integral part of the fediverse, and vice versa. Now that I know what’s possible I don’t want to go back.

The Side Track

Aside from experimenting with ClassicPress I also noticed that there are plugins that allow you to provide a summary of content headings at the top of the page, as well as a markdown parser or two to choose from. The final one was an estimated reading time. The last one isn’t that intereting, but it’s a curiousity worth knowing about.

And Finally

When I can get the exchange of comments to be from the Fediverse to my blog, and vice versa withput having to comment first I will be happy because then it will be seamless and I will be able to dump WordPress and focus on ClassicPress.

Conversing With Google Bard

Conversing With Google Bard

Two days ago I was given access to Google Bard and since then I have been experimenting. The key feature that sets Google Bard apart from ChatGPT is that it can answer questions about what is happening at the moment, rather than before September 2021. By being current you can ask it about yesterday’s news or the upcoming weather for a location, and it will give a useful answer. This is useful for time sensitive questions.


Swearing


Some of us sometimes swear at Siri, out of curiousity, to see how she reacts. I find that she sometimes sulks. I asked Bard how it felt about swearing and it responded that it will try to understand the question, rather than stop responding.


  • That’s interesting. I didn’t know that Siri sulks when she is sworn at. I can see how that would be frustrating for users.
  • I think it’s important for AI assistants to be able to handle being sworn at without getting upset. After all, people are going to swear at them sometimes, whether it’s intentional or not. If an AI assistant sulks or gets angry when it is sworn at, it’s not going to be very helpful.


Bard Humour


I asked Bard about bards, being tied up at the end of stories, during banquets and Bard gave answer that was based on American culture so I specified that I was thinking of the Asterix bard so it gave a more relevant answer, going so far as to quote two or three specific story incidents.


When I asked specifically about humour it answered that it does not have a sense of humour, itself, but that it does know how to write a joke, by studying the jokes that it has been taught.


Tic Tac Toe in PHP


I asked Bard to help me write a game of tic tac toe in php and it gave me the answer, but wheras chatGPT would give me the answer and stop there, Bard gives a hyperlink to the source it used, for the instructions. If you write something helpful, and bard uses it, then it will drive traffic to your website.


Sharing


When you are happy with the answer you are given you can either share entire threads of conversations, or just a specific question and answer. This means that you can share the series of questions that got Bard to give you the answer that you wanted to get to.


Feedback


Bard allows you to give feedback. You can give either a thumb up or thumb down. You can also ask for a reply to be longer, shorter, simpler, more casual or more professional. If you click on “view other drafts” you can see two more draft answers and select the one that you prefer. By default it gives you these three answers.


It Remembers


Google Bard remembers the thread of the conversation so if you start speaking about a topic then you can get from point A in a conversation to point B and elaborate on ideas. I had a conversation with Bard about the current COVID situation in CH and it gave good answers. It used the low rate of 3 cases per 100,000 to explain that the situation will be worrying when it reaches 50 per 100,000. It has given one of the best answers I have seen from humans, or AI because it quantified its answer.


A Learning and Studying Tool


As I ask questions about the Léman water flow, water use, and consequences downstream I see that Google Bard is an excellent learning resource. It gives good answers, and you are either given links to the articles that the answer is based on, or you are encouraged to search for other answers, on the web, to learn more.


A Conversation with Bard About Existentialism.


As I was playing with Bard, asking a series of questions I asked a question where I mixed English and French and it automatically switched to French and gave me an answer to that question in French. Bard is as multilingual as we are. it can help you explore and develop questions and answers. It can help you learn about topics by asking questions. Learn about one thing, read more, learn about something else. Read morea about it.


The AI Learning Rathole


With Bard you can spend hours learning about things, asking a series of questions and getting answers. It doesn’t get tired of your questions so you can ask, until you lose focus or attention. I especially like that with some answers it gives hyperlinks to three more resources, to be checked.


And Finally


Although I could keep writing about this topic I believe that the key strength of Bard compared to ChatGPT, is that it encourages you to follow links to read from primary or secondary sources, rather than trusting AI blindly. It also provides us with a new and more conversational apporach to “google searches”. We go from phrasing a question for a search engine to give a usable answer, to chatting with AI. By chatting with AI we learn more, and once we know what we really want to learn about, Bard has signposted the way, to learn more.


I was sceptical about AI and Google search but now that I see how it has been implemented, I like it. It works well, in my eyes. Rather than limit us, it encourages us to explore. AI should be a stepping stone, rather than the end point.

Transitioning from WordPress to Hugo

Transitioning from WordPress to Hugo

Transitioning from WordPress to Hugo is tempting because I don’t need an entire CMS for what I’m doing. What I need is a centralised system that checks for tags, titles and the theme, and updates the navigation as I add new pages. You don’t need a CMS for that.


The Good Old Days


If you go through the meta data for many of my static pages you will see that they were created with dreamweaver, frontpage 2000 and other solutions. The aim of these was to create an application that would prepare the html and navigation for pages, so we could concentrate on content creation. This was before the age of the CMS.


A short Learning Curve


If you want to create a simple blog, without changing much the learning curve for WordPress and Hugo is short, compared to what is required for Laravel, Angular and other solutions. You create content and there are tools that will take care of almost everything else.


With Hugo and WordPress you can, theoretically, start creating content and sharing it within minutes, or even seconds, depending on how many times you have set things up before.


HTML or Markdown


With Hugo if you want to create a simple page you can use markdown and save a lot of time and effort. You focus on headings, images, lists and hyperlinks. If you want to have more flexibility you can generate an HTML page, and with this you can do anything you want, and have the experience, to do.


  • hugo new blogs/big-timber.html


  • hugo new posts/hugo-and-wordpress.md


A Huge Mess


I need to find a solution to a problem. I have a blog with thousands of articles so I have thousands of markdown pages in a single directory. I considered using the creation date with year-m-d-article-title.md but if I do this then Hugo will use that as the headline for new blog posts. I would need to edit the Title of new posts, to remove the date information. For the public folder, once the blog is exported the files are tidy.


Thousands of Files and Directories


Hugo likes to create a folder and file for every single page. The result is that every page has its own folder. That’s fine, when everything is working well, but chaotic every time you make changes. At the moment of writing every change generates 6000 files and folders. That’s 10-20 seconds per export, and this doesn’t include the upload time.


Minor Changes With A Big Cost


When you’re using a CMS like wordpress changing a theme takes seconds. You find a theme, apply it, and a few seconds later you’re ready to role. With Hugo if you change the theme you need to regenerate and then reupload the website in its entirety. Small changes become big changes. Having said this, with a static website, managed by hand, rather than Hugo, this would take hours, rather than seconds.


Very Fast, Flexible


I see that Hugo is fast and flexible. It provides the organisational features of a CMS with the flexibility of HTML pages, when that is desired. This makes it easy to circumvent the limitations that are imposed by markdown, for those that want to embed videos or other features into a specific web page or blog post.


And Finally


Hugo requires no back end. Anywhere that you can upload html, can display a Hugo website, or individual pages. You have the ability to tell Hugo where the files will be on a server, so that links are built to play nicely. Both the static part of my website, and the blog may soon run via Hugo.

Playing with AI and Learning to Keep It Simple, Silly

Playing with AI and Learning to Keep It Simple, Silly

Yesterday I was playing with AI in the evening and I asked it to help me write a function that would detect whether an array item was a photo or a video. I told the AI, this is a photo array item, and this is a video array item. I want the photo array item to display the img src code and for the video item to be displayed with video src code. At first it failed to detect anything and gave me an error message. I decided to highlight the photo array item snippet and the video array snippet. 


It didn’t come back with an error but it did not display any img or video code. In the end I decided to say “here’s the img src tag. I want you to detect whether the file is mp4 or jpg. If it’s mp4 add the video player, and if it’s a photo load the image. I went from asking it to read the array to determine what to do, to “check the filetype and load the appropriate src type. That worked, and required very little code. 


Don’t Over-Engineer With AI


The moral I came away with, after the trial and error I went through last night is that whilst AI is great at reading and understanding code, and giving us answers it can sometimes fail. I was making something far more complicated than it had to be and chatGPT got confused, as would a human trying to complicate something simple. 


PHP has a lot of functionality built into it. It has tools that allow it to read exif information, file types and more, and if you know about these tools, then you can come up with elegant solutions, rather than complicated ones. 


The Winning prompt: 


I want to check whether a file is .jpg or .mp4. I want the default to be this: echo ‘ ' . $title . ' ‘; It the loop detects that the file is .mp4 I would like the video player to be loaded instead.


The Code


if (isset($article['media'][0]['uri'])) {

$fileUri = $article['media'][0]['uri'];

$fileExtension = pathinfo($fileUri, PATHINFO_EXTENSION);

if ($fileExtension === 'mp4') {

    echo '';

} else {

    echo '' . $title . '';

}

}


It gives a summary of what it did: 


In this code, we use the pathinfo() function to extract the file extension from the $fileUri. If the file extension is .mp4, we generate the video tag with the src attribute pointing to the video file, and if it’s not .mp4, we generate the img tag with the src attribute pointing to the image file.


But Wait, There’s More


I then asked chatGPT “Would it be better to determine a file type by reading the array type from a php array, or checking the file directly with php info?


The answer it gave was “In this code, we use mime_content_type() function to retrieve the MIME type of the file. We then check if the MIME type starts with image/ or video/ to determine if it’s an image or a video. This approach provides a more reliable way to determine the file type based on its content.” after providing an alternative code for me to use instead.  


Iterating


I was reading an article about AI and how Stack Overflow didn’t want to use AI for answers because it provided them with a lot more work but I think that AI is interesting because it allows you to experiment with different approaches. In fact you can ask chatGPT a simple question. Is Solution A or Solution B if I want to do C12, and it will come back with an answer, and then you can ask about how to write the code. In my eyes the strength of chatGPT is that it allows you to experiment and cycle through options much faster than if you were reading dozens of articles and solutions to find one that would work. the more I play/experiment, the more I learn, and the more I learn, the faster I can engineer prompts that will get the code I require. I like consolidating what I have learned, with chatGPT as a pair programmer. 

My AI Teacher

My AI Teacher

Today I want to discuss something different. I want to discuss using AI as a teacher, rather than as a tool to replace us. For a few days I have been playing with the Instagram json file that I got when I requested my archive. With this json file I thought about things to do, and in so doing asked chatGPT for help, and it provided answers.


Adapting the Questions


When you ask chatGPT to do something it will do what you asked. If you see that you got a partial answer then you can tell chatGPT more specifically what to do. In some cases I would ask it to do something, but I didn’t tell it that the data was in an external file, so I told it the name of the external file and it was added.


You Still Need to Think And Understand


Although ChatGPT is a great tool you need to learn to debug. Sometimes if you get an error message you can ask chatGPT how to resolve it, but in other cases, chatGPT will not realise what the error is.


The Zero Width Asset


A heatmap of photos taken per day from the Instagram JSON data for my account


Yesterday I was trying to generate a heat map of when I took photographs with ChatGPT via the instagram json file but it did not detect that the height for an element had been set to zero. It’s by experimenting that I found this error and fixed it. ChatGPT gave me a useful answer, but only resolved part of what I was trying to achieve. I had to do the rest.


Testing and Double Checking


In one case I told chatGPT that I wanted to make something available in the head element. It helped me to do that but then removed some functionality from another part of the page. I had to tell it “put that functionality back”, not in those words, and it did. Double check everything.


Trial And Error


Coding, and finding solutions, with chatGPT is about having an idea, and seeing if, and how, to get chatGPT to understand the request that you’re making. I find that I often have to ask a question several times, and in different ways, before I get to an answer that is useful for me. The more you play with chatGPT the more you learn about its quirks and how to avoid them.


Context Aware


One feature that I find especially useful with chatGPT is that it is context aware. With Google you can ask how to do something, but usually you can’t go into the specifics because it is not as context aware. The best example I can think of is the array. With an array you have layers within layers and it can be confusing to see whether something is one or three layers down, and how precisely to get to that data. With chatGPT you can say “here’s one array item, I want to retrieve x from that array, how do I do it, and it does. It gives you the request you need to access that bit of information from the array.


Practical Example


The Instagram Archive JSON is thousands of elements, but they all have the same structure, as long as they have the same data. The first step is to create the foreach loop to cycle through the data. Getting the first bit of info, with the instagram json file was easy, but deciphering the exif element wasn’t, so I asked chatGPT for help within this specific context, and it worked fine. I could then copy and paste for the exif that I had not asked it to help me with.


Converting Time Stamps from Epoch to Human Readable Dates and Times


There are plenty of places where you can find where to convert from epoch to machine readable time. chatGPT can also provide you with a context relevant solution, rather than a generic one.


Learning by Repetition


People may say “but you’re not learning, you’re just playing with chatGPT in the hope that it will give the right answer, to which I answer that we all learn in different ways. People that studied computer science and understand all of the theory might be able to read the fabulous manual, and understand everything, but for those of us that are learning bits and pieces, in an informal context, chatGPT allows us to ask “how do I do this in that context?”


We are learning three skills in processes such as mine. The first is to think about how to write functions for an app. The second is being able to communicate this desire to an AI. The skill has a name: Prompt engineering. It wouldn’t have a name if it wasn’t an important aspect of working with AI. The final skill we are learning is how to assemble code to make it work as we want it to work.


ChatGPT doesn’t just give us a few lines of code. It provides us with relevant contextual information to help us understand what is happening.


In short chatGPT can be used as a tutor, or course program, to teach us how to write better code, when others may not be around, or have the time to help us.


Udemy Courses


At least two of the “teachers I followed on Udemy, to learn about JavaScript and other technology have now made courses teaching people how to use AI to help them with their workflows. Rather than watch how others are using chatGPT I am playing and learning, with projects I think up. It’s fun. I should call it experimenting, rather than playing, but in the end I am playing.


Does this make sense to chatGPT?


Does that make sense to chatGPT?


Would chatGPT understand what I mean if I asked this?


ChatGPT and Debugging


I find it really interesting that chatGPT can be used for debugging. It tells you, do this using that library, assuming that the library is installed, but if it isn’t then you need to install it, but that’s not the end. You need to see which version chatGPT meant for you to implement. I got error messages and asked chatGPT for help, tried one version, got another error message. I then shared the new error message and chatGPT said “Oh, if you’re using this version then you’re meant to use this code, rather than that code.” I didn’t change the code. I swapped versions and the app worked.


Conclusion


The more time you invest in prompt engineering, with a specific goal in mind, the more you will learn, and the more you learn, the more useful chatGPT becomes. It goes from being an interesting curiousity to being an interesting tool.

A Desire to Dump WordPress

A Desire to Dump WordPress

In theory WordPress is a fantastic tool to write a blog, without needing to learn to code. In practice I am tired of WordPress and I have been tired of WordPress ever since they started to use blocks, and ever since I noticed that it uses React. 


React and Meta


I know that PHP was developed by Facebook, and that we use it all the time, but I also know that React was developed by Facebook as it was morphing into Meta, the destroyer of the independent web. Instagram and Whatsapp were destroyed by Facebook, as the monopolist took over those accounts. 


Blocks and ClassicPress


I am not alone to feel this way. I see that there is the ClassicPress community. I tried ClassicPress and it works, but it feels like time could be better spent with a different project, that diverges, and has a more concrete direction than “We don’t like blocks”. I am oversimplifying. I realise it’s more than that. 


Hugo


After playing with Hugo for a week or two I think that this would be a very nice solution. I don’t need comments, and I don’t need a complicated backend for the type of blogging I do. I believe that Hugo would easily fill the gap left behind by WordPress. 


Dormant WordPress


If and when I do make this change I won’t convert my WordPress blog to Hugo. I would simply create a new directory and write blog posts that would go there. I am still not certain of my strategy. For now the goal is to have my static website running Hugo cleanly, before then adding the blogging section. Within the next week I should be ready to make the leap. 


And Finally


Before WordPress I tried plenty of different content management tools and services, as can be seen in the wayback machine.  I am migrating, primarily because I want to try something new. I want to learn how to use a new tool and expand my skills, rather than have them plateau. The reason for the switch can be described in a single word. Curiousity. I am curious to see how I can use this “new” tool, to blog, with a different workflow. 

Playing with the Hugo With An Old Site

Playing with the Hugo With An Old Site

For a few days I have been playing with Hugo with Markdown and HTML pages. It says that it is “the world’s fastest framework for building websites” and so far I do notice that it has a key strength that I like. 


Front Matter


That strength is that with small modifications you can take an existing static website and make it dynamic.  Hugo requires that each page has Front Matter.  


Front matter is:


• title


• date


• tags


• description


• author


• slug


• draft


• and more. It’s a quick and easy way of organising a website, one page at a time. 


Front Matter according to chatGPT is “a metadata configuration section that is commonly used in static site generators like Hugo, Jekyll, and others.” It is placed at the top of a document to provide useful information like post title, publish date, tags and more. The beauty of tags, author and other tags is that they are used to organise data without the need for a CMS back end. 


The Niche it Fills


The advantage of Hugo, over a CMS like Wordpress, is that it doesn’t lock you into itself. It allows you to create pages, and to organise those pages by tags, category or other. It allows you, via the layout metadata to specify which css layout a page should use. You can have one website section with one theme, and another section with another theme. 


If your website has a section that is about geography, and another about environmental systems. You use the relevant tags for each page. If you click on the geography tag you get a page with a list of all the pages tagged with geography. If you click on “Environmental Studies” you get the content on that topic. 


Aside from creating tags you can create a hierarchy. If you write “film/french” it will recognise that you have the tag “film” and within that tag you have the sub tag of french. If you write about french films you can add the tag “french/film” rather than “french, film” and it will create sub-tags. This is an effective means of organising tags. 


The Weaknesses


When you create pages their default is draft, which means that you need to change draft to false if you want it to generate pages with the hugo command. When a page is generated it does not switch the draft status from true to false, so you need to tell it to export drafts each time. 


When you generate the static website it creates a directory for each page, with an index.html page in each. 


The same is true of the tags page generation. If you have 20 pages you will have 20 directories with index.html pages. If you have  100 tags you will have one hundred folders with an index.html file and an index.xml page.  If you want to fix this Hugo calls them ugly URLs


Switching from Pelican to Hugo


Initially I thought Pelican looked like a powerful tool until I encountered the issue with categories being “one per page” by default. The plugin to allow for more was simple to implement but I like to experiment with tools and I found that Hugo is an interesting alternative. 


The Strength


I want the flexibility of a CMS driven website without being stuck within Wordpress or another CMS. This tool gives me the features of a CMS without the limitations. As i add Front Matter information to each page, so it becomes easy to index every page and update navigation one final time, rather than every single time small changes are made. 


Partial Templates


With Hugo you can create partial templates, as you can with Laravel and other framework tools, except that with this framework html and markdown are used. The learning curve is more gradual. 


The Sitemap


A nice feature of Hugo is that it generates a sitemap with information about the location of each file, when it was last changed, the change frequency and priority. In this way Google and other search engines may quickly see what has changed and when. 


And Finally


If your website is already written in HTML it makes sense to find a tool that will connect all the pages together, for navigation. The CSS, JS, and html stay the same. It’s just the framework behind the scenes, connecting everything efficiently. 

Playing With Pelican – A Static Blog Website

Playing With Pelican – A Static Blog Website

When looking at Codeberg as a European alternative to github I came across mentions of Pelican, a static blog generator. Yesterday I spent several hours setting it up and playing. Whilst playing with it I saw some opportunities. 


By default Pelican is designed to have one category per blog post. For small websites this is fine. It encourages people to focus on three to five topics, and ensure that each topic is clearly visible in the nav bar at the top of the page. 


When I imported two different wordpress blogs I had success is importing the blog posts, but a failure when it came to the nav bar. 


How Does Pelican Work


Pelican can use html, reStructuredText or markdown. It wants to know the date, tags, category, slug, authors, summary and more for each page. Once a page has this information, as well as some content you type “pelican content” and it will generate the static website for you. You can then test the site with pelican listen and check that the website is displaying and working as desired. 


Categories


If I wrote a blog post about hiking in Vaud, Switzerland I would have that blog in “hiking”, “Switzerland” and “Vaud”. Pelican combined the three categories and created a nav page. The result is that I had a bloated nav bar. 


When I enquired about parsing the categories I was told that Pelican wanted to have one category per page, intentionally. They also told me that a plugin allows you to create more categories.  This plugin is quick and easy to install and implement. 


More Categories


With More Categories you can add several categories per blog post, but you can also add a hierarchy. If you write a post about hiking in Vaud, Switzerland, you can have hiking, vaud, switzerland, as a flat hierarchy. You can also have “sports/hiking” and “Switzerland/Vaud” as subcategories. This opens up the possibility of creating a nuanced static website. 


Importing a Website


You can import content from another source by using pelican import. You can choose from Blogger, Wordpress etc. I experimented with importing from Wordpress and it  worked well, except for the issues I mentioned earlier. 


Streamlining an HTML Site


My website is split into three parts


The legacy HTML section


• the main blog


the photo blog


After the two tests I ran yesterday I came to the conclusion that, for now, I will keep using wordpress for the blogs. The reason I think Pelican is interesting for me is that it can read html and the legacy part of my website is html. The challenge with legacy code is keeping the navigation and other parts up to date each time you make small changes. With Pelican I hope to delegate navigation creation. By ensuring that each page has the correct meta data in the header I can then get Pelican to regenerate the website with a navigation that is easier to keep up to date. 


Measuring Success


If I am successful then I will have the website imported into Pelican and I will have a geography, environmental systems, Ancient Rome, and other sections and one or two sections will have themes that are specific to them. 


List of other Python Static Website Generators