Giter VIP home page Giter VIP logo

contenido's Introduction

Setup

Assets

Middleman maintainers have got rid of Sprockets based assets a while ago and have implemented a feature called external_pipeline instead. In practice it allows us to use any front-end dependency manager and on this project webpack handles assets. To make your local development environment compatiable, please, install yarn first (brew install yarn should handle it for Mac users).

Packages

Once yarn is installed run ./bin/setup in the project directory – this command will pull all of the gems and npm modules required for this project.

Environment variables

Setup creates .env file in the root of application directory and the most of variables already stated there, but some extra sensitive (such as AWS and Contentful credentials) were missed intentionally. Before moving forward, please, get proper values for CONTENTFUL_ (the most important ones) and AWS_ vars and update .env accordingly. The best person to ask about these credentials is probably @skatkov. Or you can sneak them from Wiki (be careful with AWS though, CI variables refer to the live bucket).

Local content

If you have Contenful ENV vars in place, you are able to say bundle exec middleman contentful --rebuild. This command will fetch up-to-date data from Contenful API and place categories and articles entities into project data directory. Don't warry about possible error messages from webpack – contentful_middleman gem is not fully compatible with Middleman v4 yet which probably causes undesirebal output. Strictly speaking, Middleman coukd work without fetched data, but you will see only the basic HTML layout without any articles.

Development

To run project locally say bundle exec middleman server. From now on, local instance of content platform is available on http://localhost:4567/. We use middleman-livereload which means that if you update any of local files page will be reloaded automatically (except for Contentful data - you'll have to rerun rebuild command from the section above, stop Middleman and run it again).

Deployment

Basically, you don't have to perform any extra movements to get your changes deployed to production – CI server handles everything for you and once you push to master, CI compiles static build and synchronises files (both articles and assets) with S3. Though I'd recommend to take a look at circle.yml so you have better understanding what steps involved.

If you wish to update staging space from your local development environment – no probs, just get proper vars from Wiki and perform all steps which supposed to be performed by CI:

# Fetches data from Contentful
bundle exec middleman contentful
# Rebuilds files locally
bundle exec middleman build
# Synchronizes build with Amazon S3 bucket
bundle exec middleman s3_sync

Data management on the Contentful side based on the similar principle – once article or category is update there, Contentful fires webhook which hits CI rebuild so we have files built and data synchronised.

contenido's People

Contributors

query-string avatar fanahova avatar dvdbng avatar

Watchers

David Alphen avatar Charles avatar  avatar  avatar Carlos Cervantes avatar Joey Cruz avatar James Cloos avatar Eduard avatar David Reiff avatar Gavin Hewitt avatar  avatar

contenido's Issues

Add https protocol support

At the moment it is impossible to reach any of pages by HTTPS, only HTTP copies are available. It is very important to provide HTTP access because Google penalizes non-https websites.

¡Ay caramba! page improvement

After moving from our old content platform to contenido we lost a small bunch of articles (coupons and farmsep for instance) and questions pages. To make this loss less painful for the users it would be great to improve contenido 404 page – add there the questions widget + random articles and questions block.

SEO: get rid of multiple URls for identical articles

I have recently come across one issue on Content Platform that could possibly affect search engines ranking of articles there...

It turns out that some articles (I guess all of articles that belong to more than one category) appear with different URLs, e.g.:
https://content.saberespoder.com/articulos/educaci%C3%B3n/tramite-su-acta-de-nacimiento-sin-salir-del-pais
https://content.saberespoder.com/articulos/inmigraci%C3%B3n/tramite-su-acta-de-nacimiento-sin-salir-del-pais

As you can see, the content of these articles is 100% equal but pages have different URLs. AFAIK in such cases, search engines consider pages with different URLs as duplicates (even though the content is unique out of the website) and it might affect pages ranking in a negative manner.

Just a quick note about content duplication and its consequences

As long as we have those URLs indexed in our current Content Platform I tend to keep this scheme as is for the new one, but I would highly recommend to get rid of them, have one unique URL for each unique article thus reducing pseudo duplication.

We have had a quick chat with @tzinchenko in Slack, where she explained that articles could have many categories indeed and the first category is considering as a default. Thereby, we could easily get rid of trash URLs changing permalink scheme in this way: https://content.saberespoder.com/articulos/#{MAIN_CATEGORY}/#{ARTICLE_TITLE} (articles still will be visible in their category pages, but have unique URLs).

Replace or remove broken external links inside articles

As I remember – it should be a list of broken links saved somewhere and it would be great if we can eliminate all of them during this iteration. @stan2020, I'd be really appreciated if you could skim through the list and replace (or remove) these broken links from the articles.

Since all of the articles are on Contentful already you will need to ping @skatkov or @etavenn to obtain login and password for access. After that – Content section of sepcontent space is that you are looking for. All of the articles are searchable by title so hopefully, this task won't become very challenging (maybe just a bit boring). Please, let me know if you need any assistance with Contentful (though I'm sure it's quite intuitive).

As I mentioned in comments to another issue #50 – once changes were applied and Publish changes button pressed it could take 2-3 minutes for changes to be reflected on the page.

Translate English labels to Spanish

Initially, @etavenn requested only All tab translation here, but I wonder if other strings should be translated accordingly.

  1. "All" tab is in English. Change to "Index"
  2. Prev/next pagination
  3. Home, About in footer
  4. Related articles block

If I'm right and those strings have to be translated as well – I'd be appreciated if you could tell me how to handle 2-4 better @etavenn @stan2020

Rebuild preguntas section separetely

After importing 2.9K questions from the old content platform, despite all my efforts to cache downloaded questions, the entire site rebuild (time between pressing Publish button and changes reflected on the site) started to take ~30 minutes. Initially, we did not expect to have that many pages and such time-out is totally inconceivable.

image

Luckily, preguntas section stays unchanged almost forever which means we could try to perform following steps to speed-up the build:

  1. Temporary don't rebuild preguntas pages at all, use already compiled version
  2. Somehow don't rebuild preguntas section pages right away on articles publishing
  3. Still rebuild preguntas pages from time to time (possibly manually on release merge) to follow site layout changes
  4. Resolve issue #68 to help editors avoid suffering from pages rebuilding at all

Convert several line breaks into another type of content separator

@stan2020 has recently mentioned that Contentful preview ignores several consecutive line breaks and presents them like a single one. Most likely, it happens because of Markdown parser rules and we will have to find a way to convert several \n signs. into another type of element for content blocks separation...

Add rss feed to all articles

what title says ^^ and be sure that rss will be detected by browsers

each section should have separate RSS feed

Make it possible to disable releated articles block

This option mostly needed for satisfying aarons lawyers recommendations, but we might need to use it for future campaigns as well.

This feature must be delivered by Friday's morning (September 17'th, US).

Use Travis CI for builds

Since this project is a kind of open source it is no reason to keep using Circle CI and waste its capacity for static pages building needs. Besides, there is rumor that Travis has some cool features that Circle doesn's support.

Replace ad placeholder with real text

Here are promotional text for our main platform from @stan2020

  1. Preguntas sobre educación - escuelas locales, clases de inglés, GED? ¡Envíelas a 72237 y obtenga una respuesta directamente a su teléfono!
  2. ¿Sabía usted que puede ganar dinero haciendo horas extras con su teléfono celular? Haga clic aquí para aprender cómo!
  3. ¿Ha escuchado que puede ganar $1, $5, hasta $10 contestando encuestas? Haga clic aquí para aprender cómo!

They should be randomly shown every time page opens

Link should lead to our SEP platform

Make `About us` section editable

@etavenn in comment to #2194
Copy in the "about us" section is not current (I believe Admins will be able to edit that themselves, right?)

In fact, this section is not editable from Contentful at the moment. To achieve requested result we will have to add a new Page content type, make content platform support these pages and update About us on Contentful. I'll ping @etavenn and @stan2020 here once it will be available for edit.

Attach legit authors to all of articles (degrade Alexo Rodriguez)

@etavenn in comments to #2194:
All content appears to be written by Alexo Rodrigues (this is something Admin changes as well, right? If so, can we add a different default name? Lot's of work to change the editor name one-by-one)

To resolve this issue, I would approach it in this way:

  1. On the Contentful side – add a new content type called Author. This content type should have following fields: first name, last name, photo, default.
  2. On the Contentful side – associate Article content type with Author content type so each article can be assigned only to one author.
  3. On the Contentful side – create one or several authors, one of them marked as default. As I understand – it is barely possible to trace actual authorship for existent articles so we are relatively flexible to invent whoever we want (either real people from the team or imaginary characters).
  4. Randomly assign authors for all of the articles. It cold be done just by single API call on our side.
  5. By default, all of the new articles will be associated with author marked as default, but any of authors could be selected instead.

I'm going to convert Alexo Rodriguez to Contentful Article entry, marked it as default and from this point editors will be able to rename this entry however they want. Also, editors will be more than welcome to create several new semi-real authors – in will add some diversity and in this way articles could feel a bit more trusted.

@etavenn @stan2020 I hope you won't mind if I involve you for the stage 3 (once Author model is ready)?

Error 403 appears when some articles are opened

Steps to reproduce

  1. Goto http://sepcontent.s3-website-us-east-1.amazonaws.com/
  2. Open any of these articles

The list of broken articles:
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-c1
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-c2
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-c3
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-c4
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-b1
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-b2
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-b3
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/campana-de-momentos-consejo-semana-1-grupo-b4
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/requisitos-para-obtener-su-licencia-de-conducir-la-entrevista-con-el-dmv
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/educaci%C3%B3n/como-prepararse-para-el-examen-practico-de-manejo
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/finanzas/pasos-para-solicitar-un-itin
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/finanzas/como-la-ley-de-cuidado-de-salud-a-bajo-precio-afecta-sus-impuestosabajo
http://sepcontent.s3-website-us-east-1.amazonaws.com/articulos/finanzas/la-voz-de-la-comunidad-a-quienes-puedo-reclamar-como-dependientes

Actual Result: Caramba page appears. Error 403 appears

Expected Result: Articles are opened properly

Enviroment
current_user: User

server: http://sepcontent.s3-website-us-east-1.amazonaws.com/

browser: Google Chrome / Safari

operation system: Win 10 / iOS 10

Improve test coverage

At the moment only feature specs exist on the project (which is fine because the main responsibility of this solution is, well, to generate HTML). But still – feature specs coverage could be better. Besides, some functional specs at least for blog_helper.rb will help with maintenance in the future.

Setup `staging` flow

At the moment all approved fixes and improvements go directly to production so QA will actually have to review them after deployment which is not clever approach for many reasons. My proposal is:

– Establish staging branch where changes from approved PRs should go
– All changes merged with staging will be deployed to sepcontent.s3-website-us-east-1.amazonaws.com and this bucket should be considered as the staging one
– Once in awhile (I'd propose simultaneously with our main two-weeks release cycle) staging branch should be merged with master and applied changes delivered to prod.

Additionally, we will have to develop a process of synchronizing Contentful spaces (mostly content models. but from time to time data also might be needed). For the beginning, we could go with manual models synchronization (with a strong agreement that if content model changes in production Contenful space it must be immediately changed in staging space and vice versa). But in future, we have to consider involving some tooling for automatic spaces synchronization.

@dvdbng @skatkov @FanaHOVA would love to hear your thoughts

Content Platform v1 extinction plan

One of the main reasons of Content Platform v2 existence is our urgent need to reduce database workload on the expense of moving dynamically generated pages to the static form (and moving out from our servers as an extra benefit). On the other hand, as @stan2020 and @etavenn have mentioned repeatedly – we will need to keep articles and comments accessible for internal usage (and as a backup in case if we will want to use them in the future somehow).

In my opinion, both options are available, implementation is easy enough and we just have to prepare a list of possible steps. I'd like to propose one and looking forward to seeing your comments @skatkov @etavenn @stan2020

  1. Assign a new domain name for sepcontnet bucket as discussed in #11
  2. Once all issues from MVP launch milestone are resolved – gracefully redirect all of the calls from content.saberespoder.com to the new domain. To be honest – I'm not 100% sure that if it will be better to keep a chain of redirects (i.e. saberespoder.com -> content.saberespoder.com -> comunidad.saberespoder.com) than just change content.saberespoder.com to comunidad.saberespoder.com wherever we have it hard coded.
  3. Reduce the number of sepcontent workers on Heroku, disable autoscaling, sidekiq and add-ons like Papertrail and Elasticsearch. It will help us to cut a maintenance price drastically.
  4. Add HTTP basic auth for https://content.saberespoder.com thereby it will stay alive, but not accessible from the World – only people who know login/password pair will be available to review articles/comments (use this old instance as an archive).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.