typemill / typemill

Typemill is a lightweight, flat-file CMS designed for simple, fast, and flexible website and eBook creation using Markdown.
https://typemill.net
MIT License
427 stars 60 forks source link

Error on the homepage when switching between modes #167

Closed ghost closed 3 years ago

ghost commented 3 years ago

Hi trendschau, when I am on the homepage, both in raw and visual environment, and I change the writing mode, i.e. I switch from raw to visual or from visual to raw, the page is not found.

Checking with a software that I usually use, Meld, I noticed that the problem is created by the presence of $item->urlRelWoF = '/'; in Model/Folder.php on line 292: in fact, removing it works the passage.

Still not fully acquainted with Typemill, I don't know if that association serves somewhere else ... This test I did on the current version137, because I often have to clone it.

Update, another little thing. Also in Folder.php, on line 289 there is $item->keyPathArray = false;, while it would be better $item->keyPathArray = []; otherwise this warning (Parameter must be an array or an object that implements Countable) is issued on line 510.

trendschau commented 3 years ago

Thank you for the report, I will fix both issues. I added that code as a fix for version 1.3.6.2, because the empty item-object for the homepage caused several errors.

Not everything is super elegant because it is historically grown, but maybe a bit background:

The homepage is a bit special and painful, because it is not part of the basic folder-scan in the folder-model. With that scan typemill generates the object/array of content-items which is used for anything else (routing, navigation, paging and so on). So I created an object for the homepage manually and this seems to be buggy. The urlRelWoF means URL Relative Without Folder, it is needed for some relative links, for example if typemill is installed in a subfolder.

The keyPathArray reflects the position of the item in the array of objects resulting from the folderscan. Quite useful because you can do count($item->keyPathArray) and you know that the page is in level X of the navigation or you can pass the keyPathArray (e.g. [1,3,4]) into a function that returns the corresponding page-item[1][3][4] from the navigation (something like that).

I am not sure how you work with branches. One idea is to clone the latest version-branch (version137) once, then pull it regularly and merge it into your i18n branch, so your i18n-branch always has the latest changes?

We can change the process again if you have another idea. In the agency where I work the devs follow the gitflow-model and the flow is a bit similar.

Right now I work like this:

The idea is that everybody merges version1.3.7 with changes from others into his own local feature-branch and if the local feature is ready, then merge back to version1.3.7 so everybody else gets the changes. When the version1.3.7 is ready to publish then I merge it into master, do cypress-auto-tests, publish it and create the next version-branch.

Let me know if we should change it.

ghost commented 3 years ago

Thanks for the explanation. For the sequence of operations, locally I clone the latest version (version137), I make changes, if they are okay I bring them online in a new branch (in a mode that looks like a pull when strangers ask for changes) waiting for you to add them.

Maybe I misunderstood this: should I join my branch to version137 myself? (And that justifies adding me as a member, right?)

trendschau commented 3 years ago

Not sure, I can also merge the branches like now.

another idea is to create this branches:

We both use develop and push our changes there.

If time has come (develop is ready for a new release)

This way we have only one branch (develop) and you don't need to clone and so on. It is more the standard-way then.

What do you think?

ghost commented 3 years ago

I think this last idea of yours may be fine ... let's try

trendschau commented 3 years ago

ok, done. So I will work this way now:

Let us check if that works fine for all :D

ghost commented 3 years ago

Thank you for showing me your work sequence and, just to try, I made real but unimportant changes to the readme.

A curiosity, what commands do you use to see all the committed and in any case different commissions between develop and mylocalfeaturebranch? Or maybe you use some gui software?

trendschau commented 3 years ago

good question, I don't know yet, but I am sure there are some commands like diff and I can also check the commit-history on the github interface. But you are right, tracking changes might become tricky :D

ghost commented 3 years ago

In the Ubuntu distro of Linux I tried the git gui program at the menu View the history of all branches allows a good overview of the situation.

In the meantime I added my latest changes so I will delete my last useless branches in a few days.

I have not encountered any problems in the sequence of operations you have suggested to me. Okay so.

trendschau commented 3 years ago

Great to hear, I will check the git gui for linux mint and hope it provides the same feature.

trendschau commented 3 years ago

I checked the workflow today and merged some minor changes into develop and pushed again. I think it works good this way :)

trendschau commented 3 years ago

Hi iusvar,

this is more a private chat-ticket now (my fault, sorry) but anyway: I redesigned typemill.net and offer a development service to refinance the project a bit. Are you interested to offer service and get linked there, too?

ghost commented 3 years ago

Hi trendschau,

no problem for the channel used.

Regarding the request, I did not understand exactly. I am in doubt between:

If instead you wanted to say more, please do it.

Sorry for the frankness but I really didn't fully understand the meaning (obviously for me, and I believe for you too, English is a second language).

trendschau commented 3 years ago

Hi iusvar,

sorry for my english, yes, it was a bit misleading.

I just wanted to offer you a free backlink to your website:

The website has low traffic right now and I did not get any inquiries for development yet, but maybe in future. So if you want a link to your website on the startpage of typemill.net, then just let me know and I will add one there.

Excited about upcomming plugins :)

trendschau commented 3 years ago

The fix is published with 1.3.7 today so I will close this ticket. We can open another conversional ticket for offtopics :)